-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
681cc01
commit 6017d6c
Showing
8 changed files
with
201 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
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
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
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,48 @@ | ||
@import '../../stylesheets/variables'; | ||
|
||
.project-detail{ | ||
padding-top:2rem; | ||
h2 { | ||
margin: 0rem auto 2rem auto; | ||
padding: 1rem 2rem; | ||
width: fit-content; | ||
//border-bottom: 1px solid $color-dark-grey; | ||
} | ||
.artwork-navigation-container { | ||
display:flex; | ||
justify-content: space-around; | ||
.image-container{ | ||
margin: 2rem auto; | ||
max-width: 60%; | ||
border: 1px solid $color-dark-grey; | ||
min-width: 300px; | ||
|
||
&:hover{ | ||
cursor:pointer; | ||
} | ||
} | ||
.navigation-paddle{ | ||
display:flex; | ||
align-items: center; | ||
color: $color-primary-olive; | ||
font-size: 4rem; | ||
width: 10%; | ||
min-width:10%; | ||
justify-content:center; | ||
|
||
&.visible:hover{ | ||
color: $color-highlight-olive; | ||
background-color: $color-light-grey-transparent; | ||
cursor:pointer; | ||
} | ||
} | ||
} | ||
|
||
.caption{ | ||
margin: 2rem auto 2rem auto; | ||
padding: 1rem; | ||
font-style: italic; | ||
width: fit-content; | ||
//border-top: 1px solid $color-dark-grey; | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
src/components/project-detail/project-detail.component.jsx
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,72 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types' | ||
|
||
import Image from '../image/image.component'; | ||
|
||
|
||
class ProjectDetail extends React.Component{ | ||
constructor(props){ | ||
super(props) | ||
this.state = { | ||
currentIndex: 0, | ||
} | ||
} | ||
static propTypes = { | ||
project: PropTypes.object, | ||
} | ||
|
||
handleNavigationPaddleClick = (intChange) => { | ||
|
||
this.setState((prevState) => { | ||
const {currentIndex} = prevState; | ||
const nextIndex = currentIndex + intChange; | ||
|
||
const newIndex = (nextIndex >= 0 && nextIndex < this.props.project.gallery.length) ? | ||
nextIndex : currentIndex | ||
|
||
return {currentIndex: newIndex} | ||
}) | ||
} | ||
|
||
render(){ | ||
const {project} = this.props; | ||
const {currentIndex} = this.state; | ||
const currentArtwork = project.gallery[currentIndex]; | ||
const currentArtworkImage = currentArtwork.images.largeImage; | ||
|
||
const showLeft = currentIndex > 0; | ||
const showRight = (currentIndex < (project.gallery.length-1)) && (project.gallery.length > 0); | ||
|
||
return( | ||
<div className="project-detail"> | ||
<h2>{project.name}</h2> | ||
<div className="artwork-navigation-container"> | ||
<div | ||
className={(showLeft) ? `visible navigation-paddle left` : `navigation-paddle left`} | ||
onClick={()=>{this.handleNavigationPaddleClick(-1)}} | ||
> | ||
{showLeft && <p><</p>} | ||
</div> | ||
<div className="image-container"> | ||
<Image | ||
url={currentArtworkImage.url} | ||
altText={currentArtworkImage.altText} | ||
/> | ||
</div> | ||
<div | ||
className={(showRight) ? `visible navigation-paddle right` : `navigation-paddle right`} | ||
onClick={()=>{this.handleNavigationPaddleClick(1)}} | ||
> | ||
{showRight && <p>></p>} | ||
</div> | ||
</div> | ||
<div className="caption"> | ||
{currentArtwork.caption} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
} | ||
|
||
export default ProjectDetail; |
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