-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add NextImageLightbox component
- Loading branch information
1 parent
3793a63
commit ad75507
Showing
1 changed file
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as React from 'react'; | ||
import Lightbox from 'react-image-lightbox-rotation'; | ||
|
||
import 'react-image-lightbox-rotation/style.css'; | ||
|
||
import NextImage from '@/components/NextImage'; | ||
|
||
import { ExtractProps } from '@/types/helper'; | ||
|
||
type NextImageLightboxProps = { | ||
src: string; | ||
} & ExtractProps<typeof NextImage>; | ||
|
||
export default function NextImageLightbox(props: NextImageLightboxProps) { | ||
const [isOpen, setIsOpen] = React.useState(false); | ||
|
||
return ( | ||
<div className='cursor-zoom-in'> | ||
<NextImage onClick={() => setIsOpen(true)} {...props} /> | ||
{isOpen && ( | ||
<Lightbox | ||
mainSrc={props.src} | ||
rotate={0} | ||
onCloseRequest={() => setIsOpen(false)} | ||
/> | ||
)} | ||
</div> | ||
); | ||
} |
ad75507
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:
aether-design-system – ./
aether-design-system.vercel.app
aether-design-system-git-main-theodorusclarence.vercel.app
aether-design-system-theodorusclarence.vercel.app
aether.thcl.dev