Skip to content

Commit 3580ce6

Browse files
committed
Add color mode image component
1 parent e7cba43 commit 3580ce6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/ColorModeImage.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// So that we can easily use different images for light and dark mode
2+
import { Image, useColorModeValue } from '@chakra-ui/react'
3+
4+
export function ColorModeImage({ lightSrc, darkSrc, alt, ...props }) {
5+
const src = useColorModeValue(lightSrc, darkSrc)
6+
7+
return <Image src={src} alt={alt} {...props} />
8+
}

0 commit comments

Comments
 (0)