Skip to content

Commit

Permalink
Fix prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
e1himself committed Jan 5, 2022
1 parent 40bda85 commit 9660535
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions src/components/Lightbox/Lightbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,27 @@ export const Lightbox: FunctionComponent<Props> = ({
onNext = noop,
onPrevious = noop,
}) => {
useEventListener(typeof window !== 'undefined' ? window : globalThis, 'keydown', (event: KeyboardEvent) => {
if (image === null) {
return;
}

if (event.key === 'Esc') {
onClose();
}

if (event.key === 'ArrowLeft') {
onPrevious();
}

if (event.key === 'ArrowRight') {
onNext();
}
});
useEventListener(
typeof window !== 'undefined' ? window : globalThis,
'keydown',
(event: KeyboardEvent) => {
if (image === null) {
return;
}

if (event.key === 'Esc') {
onClose();
}

if (event.key === 'ArrowLeft') {
onPrevious();
}

if (event.key === 'ArrowRight') {
onNext();
}
},
);

if (typeof window === 'undefined') {
// Do not render Lightbox outside of browser environment (i.e. SSR)
Expand Down

0 comments on commit 9660535

Please sign in to comment.