Silence forwardRef warning in Photo component

This commit is contained in:
Caleb Denio 2024-07-08 13:39:53 -04:00
parent 36ed6e1b6a
commit a998e264c8
No known key found for this signature in database

View file

@ -2,6 +2,7 @@ import styled from '@emotion/styled'
import { Box, Card, Text, useColorMode } from 'theme-ui'
import Image from 'next/image'
import theme from '../lib/theme'
import React from 'react'
const Caption = styled(Text)`
display: block;
@ -16,7 +17,7 @@ const Caption = styled(Text)`
z-index: 0;
`
const Photo = ({
const Photo = React.forwardRef(function Photo({
src,
width,
height,
@ -24,14 +25,16 @@ const Photo = ({
showAlt,
dark,
loading,
ref,
...props
}) => {
}) {
const [colorMode] = useColorMode()
const showCaption = showAlt && alt
return (
<Card
{...props}
as="figure"
ref={ref}
sx={{
p: [0, 0, 0],
boxShadow: 'elevated',
@ -62,6 +65,6 @@ const Photo = ({
)}
</Card>
)
}
})
export default Photo