Sha256: f5b6d017b0d5e48e5a39df139b8df6464e820923729970472fe35328fe43e574
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
/* @flow */ /* eslint-disable jsx-control-statements/jsx-use-if-tag */ import React, { useState } from 'react' import { Flex, Image } from '../../' import Lightbox from '../_lightbox.tsx' const LightboxDefault = (props) => { const photos = [ 'https://images.unsplash.com/photo-1638727228877-d2a79ab75e68?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2668&q=80', ] const [showLightbox, toggleShowLightbox] = useState(false) const handleCloseLightbox = () => { toggleShowLightbox(!showLightbox) } const onPhotoClick = () => { toggleShowLightbox(!showLightbox) } return ( <> <div> {showLightbox ? ( <Lightbox icon="times" onClose={handleCloseLightbox} photos={photos} {...props} /> ) : ( <div className="PhotoViewer"> <Flex> {photos.map((photo, index) => { return ( <div key={photo[index]} onClick={() => onPhotoClick(index)} > <Image cursor="pointer" marginRight="xl" rounded size="lg" url={photo} /> <div className="overlay" /> </div> ) })} </Flex> </div> )} </div> </> ) } export default LightboxDefault
Version data entries
2 entries across 2 versions & 1 rubygems