import { clsx } from 'clsx' import styles from './Lightbox.module.scss' import { createSignal } from 'solid-js' import { Icon } from '../Icon' import { useEscKeyDownHandler } from '../../../utils/useEscKeyDownHandler' type Props = { class?: string image: string onClose: () => void } const ZOOM_STEP = 1.08 export const Lightbox = (props: Props) => { const [zoomLevel, setZoomLevel] = createSignal(1) const closeLightbox = () => { props.onClose() } const zoomIn = (event) => { event.stopPropagation() setZoomLevel(zoomLevel() * ZOOM_STEP) } const zoomOut = (event) => { event.stopPropagation() setZoomLevel(zoomLevel() / ZOOM_STEP) } const lightboxStyle = () => ({ transform: `scale(${zoomLevel()})`, transition: 'transform 0.3s ease' }) useEscKeyDownHandler(closeLightbox) return (