-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added photo grids for album/photo galleries #3
Open
sherylchang
wants to merge
7
commits into
InnoD-WebTier:master
Choose a base branch
from
sherylchang:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cd663e5
first commit
sherylchang d6368d9
separated styling into different files and linked css to js
sherylchang 44671c1
adding App.js and general styling files
sherylchang 6afb9af
added in mason's files
sherylchang 89a252b
changed linking of css files
sherylchang e9bf6d1
created initial version of the modal box
sherylchang 443d5be
got new files and routing and used npm start instead of yarn
sherylchang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, { Component } from 'react'; | ||
import Photo from './Photo.js'; | ||
import Modal from './Modal.js' | ||
|
||
class Grid extends Component { | ||
|
||
render() { | ||
const gridElements = this.props.urls.map((grid) => | ||
<Photo src={grid.url} name={grid.name} className="grid__photo" | ||
callbackFromParent={this.props.callbackFromParent} /> | ||
); | ||
|
||
return ( | ||
<div className={this.props.className}>{gridElements}</div> | ||
); | ||
} | ||
} | ||
|
||
export default Grid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { Component } from 'react'; | ||
import Photo from './Photo.js'; | ||
|
||
const display = { | ||
display: 'block' | ||
}; | ||
const hide = { | ||
display: 'none' | ||
}; | ||
|
||
class Modal extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
toggle: false | ||
} | ||
} | ||
|
||
render() { | ||
return( | ||
<div className="modal" style={this.props.toggle ? display : hide}> | ||
<div className="modal-content"> | ||
<Photo className="modal__photo" src={this.props.src} /> | ||
</div> | ||
<div className="overlay"> | ||
Overlay | ||
</div> | ||
</div> | ||
); | ||
|
||
} | ||
} | ||
|
||
export default Modal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React, { Component } from 'react'; | ||
import Modal from './Modal.js' | ||
|
||
class Photo extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { isClicked: false }; | ||
} | ||
|
||
toggleClicked = () => { | ||
this.setState({ | ||
isClicked: true | ||
}, () => { | ||
this.props.callbackFromParent(this.state.isClicked, this.props.src); | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className={this.props.className}> | ||
<img src={this.props.src} onClick={this.toggleClicked} /> | ||
<div className="label"> | ||
{this.props.name} | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Photo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { Component } from 'react'; | ||
import Grid from '../Grid.js'; | ||
import '../styles/css/Album.css'; | ||
|
||
const items = [ | ||
{ name: '2017-2018', url: 'http://www.dogbreedslist.info/uploads/allimg/dog-pictures/Samoyed-2.jpg' }, | ||
{ name: '2016-2017', url: 'http://cdn.akc.org/Marketplace/Breeds/Pembroke_Welsh_Corgi_SERP.jpg' }, | ||
{ name: '2015-2016', url: 'https://i.ytimg.com/vi/wRx3Uvcktm8/maxresdefault.jpg' } | ||
]; | ||
|
||
const items1 = [ | ||
{ name: '2014-2015', url: 'https://www.thelabradorsite.com/wp-content/uploads/2015/07/yellow-labrador-puppy-garden.jpg' }, | ||
{ name: '2013-2014', url: 'https://cdn.marketplace.akc.org/media/45488/1456977861_4573_8635.jpg' }, | ||
]; | ||
|
||
class Album extends Component { | ||
render() { | ||
return( | ||
<div> | ||
<div className="title">ALBUMS</div> | ||
<Grid className="album__grid" urls={items} /> | ||
<Grid className="album__grid" urls={items1} /> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Album; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { Component } from 'react'; | ||
import Photo from '../Photo.js'; | ||
import Modal from '../Modal.js'; | ||
import Grid from '../Grid.js'; | ||
import '../styles/css/Gallery.css'; | ||
|
||
// A base file for all your pages to come together. | ||
|
||
const items = [ | ||
{ url: 'http://www.dogbreedslist.info/uploads/allimg/dog-pictures/Samoyed-2.jpg' }, | ||
{ url: 'http://cdn.akc.org/Marketplace/Breeds/Pembroke_Welsh_Corgi_SERP.jpg' }, | ||
{ url: 'https://i.ytimg.com/vi/wRx3Uvcktm8/maxresdefault.jpg' }, | ||
{ url: 'https://www.thelabradorsite.com/wp-content/uploads/2015/07/yellow-labrador-puppy-garden.jpg' }, | ||
{ url: 'https://cdn.marketplace.akc.org/media/45488/1456977861_4573_8635.jpg' }, | ||
{ url: 'https://cdn.marketplace.akc.org/media/45488/1456977861_4573_8635.jpg' } | ||
]; | ||
|
||
class App extends Component { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remember to move all the contents from this file to the Gallery page |
||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
isOpen: false, | ||
isPhotoClicked: false, | ||
currPhoto: null | ||
}; | ||
} | ||
|
||
toggleModal = () => { | ||
this.setState({ | ||
isOpen: !this.state.isOpen | ||
}) | ||
|
||
} | ||
|
||
callback = (isClicked, photoSrc) => { | ||
this.setState({ | ||
isPhotoClicked: isClicked, | ||
currPhoto: photoSrc | ||
}); | ||
console.log(isClicked); | ||
} | ||
|
||
render() { | ||
return( | ||
<div> | ||
<div className="title">PUMPKIN CARVING SOCIAL [FALL 2014]</div> | ||
<Grid className="gallery__grid" callbackFromParent={this.callback} urls={items} /> | ||
<Modal className="modal" src={this.state.currPhoto} toggle={this.state.isPhotoClicked} /> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { Component } from 'react'; | ||
import Grid from '../Grid.js'; | ||
import '../styles/css/Events.css'; | ||
|
||
const items = [ | ||
{ name: 'First General Meeting', url: 'http://www.dogbreedslist.info/uploads/allimg/dog-pictures/Samoyed-2.jpg' }, | ||
{ name: 'Big C Hike + Pieology', url: 'http://cdn.akc.org/Marketplace/Breeds/Pembroke_Welsh_Corgi_SERP.jpg' }, | ||
{ name: '2nd General Meeting', url: 'https://i.ytimg.com/vi/wRx3Uvcktm8/maxresdefault.jpg' } | ||
]; | ||
|
||
const items1 = [ | ||
{ name: 'Guide Dogs for the Blind', url: 'https://www.thelabradorsite.com/wp-content/uploads/2015/07/yellow-labrador-puppy-garden.jpg' }, | ||
{ name: 'Go Bears', url: 'https://cdn.marketplace.akc.org/media/45488/1456977861_4573_8635.jpg' }, | ||
]; | ||
|
||
class Events extends Component { | ||
render() { | ||
return( | ||
<div> | ||
<div className="title">2015-2016</div> | ||
<Grid className="album__grid" urls={items} /> | ||
<Grid className="album__grid" urls={items1} /> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Events; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React, { Component } from 'react'; | ||
import Grid from '../Grid.js'; | ||
import '../styles/css/Gallery.css'; | ||
|
||
const items = [ | ||
{ url: 'http://www.dogbreedslist.info/uploads/allimg/dog-pictures/Samoyed-2.jpg' }, | ||
{ url: 'http://cdn.akc.org/Marketplace/Breeds/Pembroke_Welsh_Corgi_SERP.jpg' }, | ||
{ url: 'https://i.ytimg.com/vi/wRx3Uvcktm8/maxresdefault.jpg' } | ||
]; | ||
|
||
const items1 = [ | ||
{ url: 'https://www.thelabradorsite.com/wp-content/uploads/2015/07/yellow-labrador-puppy-garden.jpg' }, | ||
{ url: 'https://cdn.marketplace.akc.org/media/45488/1456977861_4573_8635.jpg' }, | ||
{ url: 'https://cdn.marketplace.akc.org/media/45488/1456977861_4573_8635.jpg' } | ||
]; | ||
|
||
class Gallery extends Component { | ||
render() { | ||
return( | ||
<div> | ||
<div className="title">PUMPKIN CARVING SOCIAL [FALL 2014]</div> | ||
<Grid className="gallery__grid" urls={items} /> | ||
<Grid className="gallery__grid" urls={items1} /> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Gallery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro"); | ||
* { | ||
box-sizing: border-box; } | ||
|
||
body { | ||
margin: 0; | ||
padding: 0; } | ||
|
||
.title { | ||
margin-top: 30px; | ||
text-align: center; | ||
font-family: 'Source Sans Pro', sans-serif; | ||
font-size: 30px; | ||
color: #424242; } | ||
|
||
.album__grid { | ||
margin: auto; | ||
max-width: 1200px; } | ||
.album__grid .grid__photo { | ||
width: 33%; | ||
height: 350px; | ||
display: inline-block; | ||
margin-bottom: 70px; | ||
padding: 25px; | ||
vertical-align: top; } | ||
.album__grid .grid__photo img { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
max-width: 100%; } | ||
.album__grid .grid__photo img:hover { | ||
opacity: 0.5; | ||
transition: 0.5s; | ||
cursor: pointer; } | ||
.album__grid .grid__photo .label { | ||
font-family: 'Source Sans Pro', sans-serif; | ||
border-bottom: 2.5px solid #424242; | ||
padding-top: 11px; | ||
padding-bottom: 7px; | ||
font-size: 20px; | ||
color: #424242; } | ||
|
||
@media (max-width: 900px) { | ||
.album__grid .grid__photo { | ||
width: 50%; } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro"); | ||
* { | ||
box-sizing: border-box; } | ||
|
||
body { | ||
margin: 0; | ||
padding: 0; } | ||
|
||
.title { | ||
margin-top: 30px; | ||
text-align: center; | ||
font-family: 'Source Sans Pro', sans-serif; | ||
font-size: 30px; | ||
color: #424242; } | ||
|
||
.album__grid { | ||
margin: auto; | ||
max-width: 1200px; } | ||
.album__grid .grid__photo { | ||
width: 33%; | ||
height: 350px; | ||
display: inline-block; | ||
margin-bottom: 70px; | ||
padding: 25px; | ||
vertical-align: top; } | ||
.album__grid .grid__photo img { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; } | ||
.album__grid .grid__photo img:hover { | ||
opacity: 0.5; | ||
transition: 0.5s; | ||
cursor: pointer; } | ||
.album__grid .grid__photo .label { | ||
font-family: 'Source Sans Pro', sans-serif; | ||
border-bottom: 2.5px solid #424242; | ||
padding-top: 11px; | ||
padding-bottom: 7px; | ||
font-size: 20px; | ||
color: #424242; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro"); | ||
* { | ||
box-sizing: border-box; } | ||
|
||
body { | ||
margin: 0; | ||
padding: 0; } | ||
|
||
.title { | ||
margin-top: 30px; | ||
text-align: center; | ||
font-family: 'Source Sans Pro', sans-serif; | ||
font-size: 30px; | ||
color: #424242; } | ||
|
||
.gallery__grid { | ||
margin: auto; | ||
max-width: 1200px; | ||
margin-top: 10px; } | ||
.gallery__grid .grid__photo { | ||
width: 33%; | ||
height: 275px; | ||
display: inline-block; | ||
padding: 20px; } | ||
.gallery__grid .grid__photo img { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
vertical-align: top; } | ||
.gallery__grid .grid__photo img:hover { | ||
opacity: 0.5; | ||
transition: 0.5s; | ||
cursor: pointer; } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you structure your Grid component so that it represents an entire grid, and not just a row?