Skip to content

Commit 93e94a9

Browse files
authored
Chore(ois) add images (#470)
* added light and dark images - WIP * pre-commit * component * final fix
1 parent 46c7bb6 commit 93e94a9

17 files changed

+110
-3
lines changed

components/DualModeImage.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type { ComponentProps } from "react";
2+
import Image from "next/image";
3+
4+
type ImageProps = ComponentProps<typeof Image>;
5+
type Props = Omit<ImageProps, "src"> & {
6+
darkSrc: ImageProps["src"];
7+
lightSrc: ImageProps["src"];
8+
alt: string;
9+
};
10+
11+
const DualModeImage = ({
12+
darkSrc,
13+
lightSrc,
14+
className,
15+
alt,
16+
...props
17+
}: Props) => {
18+
return (
19+
<>
20+
<Image
21+
src={lightSrc}
22+
className={`dark:hidden ${className}`}
23+
alt={alt}
24+
{...props}
25+
/>
26+
<Image
27+
src={darkSrc}
28+
className={`hidden dark:block ${className}`}
29+
alt={alt}
30+
{...props}
31+
/>
32+
</>
33+
);
34+
};
35+
36+
export default DualModeImage;
-42.5 KB
Binary file not shown.
-32.8 KB
Loading
75.3 KB
Loading

0 commit comments

Comments
 (0)