diff --git a/public/src/components/AlbumPhotoDisplay.jsx b/public/src/components/AlbumPhotoDisplay.jsx index cf1f251..bf83f7e 100644 --- a/public/src/components/AlbumPhotoDisplay.jsx +++ b/public/src/components/AlbumPhotoDisplay.jsx @@ -1,5 +1,12 @@ import React from 'react'; +/* ------------------------------ +Render a slideshow carousel to the page for a single album: + -carousel shows single photo with controls for previous and next + -carousel indicators renders thumbnails of the entire album of photos and can control the main carousel + -triggers a lightbox on click of the photo in the main carousel +-------------------------------*/ + const AlbumPhotoDisplay = ({photos, albums, selectAlbum, currentPhoto}) => { const slides = photos.map((photo, i) => { if (i === currentPhoto) { @@ -24,9 +31,7 @@ const AlbumPhotoDisplay = ({photos, albums, selectAlbum, currentPhoto}) => { } }) const indicators = photos.map((photo, i) => { - // if (i !== 0) { return (
  • ) - // } }) return (
    @@ -54,26 +59,3 @@ const AlbumPhotoDisplay = ({photos, albums, selectAlbum, currentPhoto}) => { } export default AlbumPhotoDisplay; - -/*
    -
    -
      -
    1. - {indicators} -
    -
    -
    - -

    {photos[4].description}

    - - -
    {console.log(0)}}> - First Slide

    {photos[0].description}

    -
    - - onClick={()=>{console.log(i)}} - -
  • - -
  • - */ diff --git a/public/src/components/album.jsx b/public/src/components/album.jsx index 86c9978..f62d33e 100644 --- a/public/src/components/album.jsx +++ b/public/src/components/album.jsx @@ -1,10 +1,12 @@ import React from 'react'; import Photo from './photo.jsx'; -const Album = ({album, selectAlbum}) => { // edited this (wip) - /*const photos = album.photos.map(photo, i) => { - return (
    ) - }*/ +/* ------------------------------ +Render an individual album row with the first 4 photos to the App for each album: + -uses selectAlbum method from app.jsx +-------------------------------*/ + +const Album = ({album, selectAlbum}) => { const photos = album.photos.map((photo, i) => { if(i < 4) { return (
    { selectAlbum(album, i); }}>
    ); @@ -15,7 +17,7 @@ const Album = ({album, selectAlbum}) => { // edited this (wip)
    -

    { selectAlbum(album); }}>{album.name}

    {/* << make dynamic*/} +

    { selectAlbum(album); }}>{album.name}

    diff --git a/public/src/components/albumPhotos.jsx b/public/src/components/albumPhotos.jsx index 57dd2d3..eab5608 100644 --- a/public/src/components/albumPhotos.jsx +++ b/public/src/components/albumPhotos.jsx @@ -1,6 +1,10 @@ import React from 'react'; import Photo from './photo.jsx'; +/* ------------------------------ +defunct not currently in use +-------------------------------*/ + const AlbumPhotos = ({}) => { return (
    diff --git a/public/src/components/albumdisplay.jsx b/public/src/components/albumdisplay.jsx index 3ea297b..8bd0450 100644 --- a/public/src/components/albumdisplay.jsx +++ b/public/src/components/albumdisplay.jsx @@ -1,12 +1,15 @@ import React from 'react'; -import AlbumPhotos from './albumPhotos.jsx'; import AlbumPhotoDisplay from './AlbumPhotoDisplay.jsx'; +/* ------------------------------ +Render a single album to the page + -calls albumPhotoDisplay +-------------------------------*/ + const AlbumDisplay = ({currentAlbum, albums, selectAlbum, currentPhoto}) => { return (
    - {/**/}
    ); }; diff --git a/public/src/components/albumlist.jsx b/public/src/components/albumlist.jsx index 3ca6fd4..5140689 100644 --- a/public/src/components/albumlist.jsx +++ b/public/src/components/albumlist.jsx @@ -1,6 +1,11 @@ import React from 'react'; import Album from './album.jsx'; +/* ------------------------------ +Render the list of albums from the album state in App.jsx + -calls Album.jsx for each album +-------------------------------*/ + const AlbumList = ({albums, selectAlbum}) => { const albumNode = albums.map((album, i) => { return (); diff --git a/public/src/components/app.jsx b/public/src/components/app.jsx index 6152330..b6abd46 100644 --- a/public/src/components/app.jsx +++ b/public/src/components/app.jsx @@ -4,6 +4,12 @@ import AlbumDisplay from './albumdisplay.jsx'; import AlbumList from './albumlist.jsx'; import Album from './album.jsx'; +/* ------------------------------ +Main react App: + -holds the states + -holds the methods +-------------------------------*/ + export default class App extends React.Component { constructor(props) { super(props); @@ -16,12 +22,12 @@ export default class App extends React.Component { currentAlbumIndex: 5, currentUser: { albums: [] - }, // change - displayUser: {} // change + }, + displayUser: {} }; } - addPhoto(photo, albumName, description, newAlbumName) { // pass in album name/id pulled from drop-down selector? + addPhoto(photo, albumName, description, newAlbumName) { var data = new FormData(); data.append('photo', photo, photo.name); @@ -47,7 +53,6 @@ export default class App extends React.Component { processData: false, contentType: false, success: function(response) { - console.log('success', response); this.setState({albums: response.albums, photos: response.photos}); }.bind(this), error: function(error) { @@ -58,8 +63,6 @@ export default class App extends React.Component { selectAlbum(album, photo) { let photoNum = photo || 0; - console.log(album); - console.log(photoNum) this.setState({currentAlbum: album, currentPhoto: photoNum}); } @@ -68,9 +71,7 @@ export default class App extends React.Component { type: 'GET', url: '/user/' + this.state.currentUser, success: function(data) { - console.log(data); this.setState({albums: data.albums, currentUser: data, displayUser: data}); - console.log(this.state.albums); }.bind(this), error: function(err) { console.error('error', err); @@ -78,12 +79,7 @@ export default class App extends React.Component { }); } - changeAlbum(dir) { - //dir -1 or 1 - // set.state of current album to next or previous album - } - - renderPage({currentAlbum, albums, selectAlbum, currentPhoto}) { + renderPage({currentAlbum, albums, selectAlbum, currentPhoto}) { //logic for whether a single album should display or album list if (currentAlbum === null) { return ( ); - //return (); } else { return ( - - -*/ diff --git a/public/src/components/navbar.jsx b/public/src/components/navbar.jsx index 500bf87..1b5c6bd 100644 --- a/public/src/components/navbar.jsx +++ b/public/src/components/navbar.jsx @@ -1,7 +1,12 @@ import React from 'react'; -// import Bootstrap from 'bootstrap'; import PhotoForm from './photoform.jsx'; +/* ------------------------------ +Render Navbar to top of page: + -uses bootstrap navbar + -calls on PhotoForm +-------------------------------*/ + const Navbar = ({addPhoto, currentUser}) => { return ( diff --git a/public/src/components/photo.jsx b/public/src/components/photo.jsx index c71abd2..2c64291 100644 --- a/public/src/components/photo.jsx +++ b/public/src/components/photo.jsx @@ -1,5 +1,9 @@ import React from 'react'; +/* ------------------------------ +renders a single photo currently in use from album.jsx +-------------------------------*/ + const Photo = ({photo}) => { return ( diff --git a/public/src/components/photoform.jsx b/public/src/components/photoform.jsx index d491179..d0dfd28 100644 --- a/public/src/components/photoform.jsx +++ b/public/src/components/photoform.jsx @@ -1,5 +1,10 @@ import React from 'react'; +/* ------------------------------ +Render Photo upload form to dropdown in navbar: + -call upon addPhoto method from App.jsx +-------------------------------*/ + const PhotoForm = ({addPhoto, currentUser}) => { let photo; let name; @@ -27,11 +32,10 @@ const PhotoForm = ({addPhoto, currentUser}) => { }); return ( -
    { // add a drop-down selector for album? + { e.preventDefault(); addPhoto(photo.files[0], name, desc.value, newName.value); photo.value = ''; - // name.value = ''; desc.value = ''; newName.value = ''; }}> @@ -67,10 +71,3 @@ const PhotoForm = ({addPhoto, currentUser}) => { export default PhotoForm; -/* -
    - { - name = node2; - }}/> -
    - */ diff --git a/public/src/index.js b/public/src/index.js index 57e5585..c2fcbef 100644 --- a/public/src/index.js +++ b/public/src/index.js @@ -1,13 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/app.jsx'; // eslint-disable-line -// import Bootstrap from 'bootstrap/dist/css/bootstrap.css'; -// var React = require('react'); -// var ReactDOM = require('react-dom'); -// var App = require('./components/app.jsx'); -// var test = () => console.log('test'); - -// test(); +/* ------------------------------ +Render react app to html dom +-------------------------------*/ ReactDOM.render(, document.getElementById('app')); // eslint-disable-line diff --git a/public/styles/style.css b/public/styles/style.css index f252107..a9972a9 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -3,19 +3,20 @@ padding-bottom: 10px; width: 300px; } -/*.dropdown-menu .form-group { - margin-bottom: 7px; -}*/ + .navbar-brand { padding: 1px 6px; } + .navbar-brand>img { max-width: 150px; } + body { padding-top: 50px; padding-bottom: 50px; } + .new-name-hidden { display: none; } @@ -27,9 +28,11 @@ body { height: 500px; max-height: 500px; } + .carousel .item{ min-height: 280px; /* Prevent carousel from being distorted if for some reason image doesn't load */ } + .carousel .item img{ margin: 0 auto; /* Align slide image horizontally center */ width: auto; @@ -84,11 +87,6 @@ body { color: #93c7ff; } -.carousel-caption h3 { - /* color: black !important; */ - -} - .img-responsive { height: 250px; } @@ -96,6 +94,7 @@ body { .album-title { color: #29a7b4; } + .album-row { background: #5486a5; padding-top: 10px;