-
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
2b80a9d
commit 07a3d90
Showing
4 changed files
with
31 additions
and
14 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -1,29 +1,36 @@ | ||
import PhotoAlbum from "react-photo-album"; | ||
import NextJsImage from "@/components/nextJsImage"; | ||
import { photos } from "@/lib/photos"; | ||
import PhotoAlbum from 'react-photo-album' | ||
import NextJsImage from '@/components/nextJsImage' | ||
import Lightbox from 'yet-another-react-lightbox' | ||
import Zoom from 'yet-another-react-lightbox/plugins/zoom' | ||
import 'yet-another-react-lightbox/styles.css' | ||
import { photos } from '@/lib/photos' | ||
import { useState } from 'react' | ||
|
||
const Photography = () => { | ||
const [index, setIndex] = useState(-1) | ||
|
||
// Breakpoints in px for the number of photos per row | ||
const fourColumns = 1400 | ||
const threeColumns = 900 | ||
const twoColumns = 600 | ||
|
||
const rowConstraints = (w: number) => ({ maxPhotos: w > fourColumns ? 4 : w > threeColumns ? 3 : w > twoColumns ? 2 : 1 }); | ||
const rowConstraints = (w: number) => ({ maxPhotos: w > fourColumns ? 4 : w > threeColumns ? 3 : w > twoColumns ? 2 : 1 }) | ||
|
||
return ( | ||
<div className="w-full px-4"> | ||
<h1 className="text-center py-6 text-2xl">Photography</h1> | ||
<div className='w-full px-4'> | ||
<h1 className='text-center py-6 text-2xl'>Photography</h1> | ||
<PhotoAlbum | ||
photos={photos} | ||
layout="rows" | ||
layout='rows' | ||
rowConstraints={rowConstraints} | ||
renderPhoto={NextJsImage} | ||
defaultContainerWidth={1200} | ||
spacing={(containerWidth) => (containerWidth < 600 ? 5 : 10)} | ||
onClick={({ index }) => setIndex(index)} | ||
/> | ||
<Lightbox slides={photos} open={index >= 0} close={() => setIndex(-1)} index={index} plugins={[Zoom]} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default Photography | ||
export default Photography |
07a3d90
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.
Successfully deployed to the following URLs:
john-portfolio – ./
john-portfolio-flapshatner.vercel.app
john-portfolio-xi.vercel.app
john-portfolio-git-main-flapshatner.vercel.app