Raw
1 "use client"
2
3 import React from "react"
4 import { useColorMode } from "@/providers/ColorMode"
5
6 export type ThemeImageProps = {
7 light: string
8 dark?: string
9 alt?: string
10 } & React.AllHTMLAttributes<HTMLImageElement>
11
12 export const ThemeImage = ({
13 light,
14 dark,
15 alt = "",
16 ...props
17 }: ThemeImageProps) => {
18 const { colorMode } = useColorMode()
19
20 return (
21 <img
22 alt={alt}
23 src={colorMode === "light" ? light : dark || light}
24 {...props}
25 />
26 )
27 }