diff --git a/src/components/Body/Lightbox.jsx b/src/components/Body/Lightbox.jsx index 9970304..1a98155 100644 --- a/src/components/Body/Lightbox.jsx +++ b/src/components/Body/Lightbox.jsx @@ -27,9 +27,15 @@ const Lightbox = ({ const [face, setFace] = useState(null); const imgRef = useRef(null); - const Faces = styled.div` - width: ${imgRef?.current?.width}px; + const aspectRatio = (imgRef) => imgRef?.current?.naturalWidth / imgRef?.current?.naturalHeight; + + const FacesWrapper = styled.div` + width: ${aspectRatio(imgRef) * imgRef?.current?.height}px; height: ${imgRef?.current?.height}px; + margin-left: auto; + margin-right: auto; + left: 0; + right: 0; position: absolute; `; @@ -42,12 +48,12 @@ const Lightbox = ({ src={photo.url} alt={"fullsize"} /> - + {photoInfo?.person?.map(person => - ())} - +