Skip to content

Commit

Permalink
feat(Next > Album): Show city and location details
Browse files Browse the repository at this point in the history
  • Loading branch information
danactive committed Jan 9, 2022
1 parent 11167f3 commit b45edd0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/pages/[gallery]/[album].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ function AlbumPage({ items = [] }) {
filtered,
searchBox,
} = useSearch(items)
const [viewed, setViewedState] = useState([0])
const setViewed = (index) => setViewedState(viewed.concat(index))
const [viewed, setViewedList] = useState([0])
const [details, setDetails] = useState(filtered[0])
const setViewed = (index) => {
setDetails(filtered[index])
setViewedList(viewed.concat(index))
}

function selectThumb(index) {
refImageGallery.current.slideToIndex(index)
Expand All @@ -64,6 +68,9 @@ function AlbumPage({ items = [] }) {
</Head>
{searchBox}
<SplitViewer setViewed={setViewed} items={filtered} refImageGallery={refImageGallery} />
{details && details.description}
<h3>{details && details.city}</h3>
<h4>{details && details.location}</h4>
<Wrapper>
{filtered.map((item, index) => (
<ThumbImg
Expand Down

0 comments on commit b45edd0

Please sign in to comment.