aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/components/image/ThemedImage.tsx
diff options
context:
space:
mode:
authorHsiangNianian <admin@jyunko.cn>2023-04-22 19:52:26 +0800
committerHsiangNianian <admin@jyunko.cn>2023-04-22 19:52:26 +0800
commit4838df315931bb883f704ec3e1abe2685f296cdf (patch)
tree57a8550c4cd5338f1126364bb518c6cde8d96e7d /docs/components/image/ThemedImage.tsx
parentdb74ade0234a40c2120ad5f2a41bee50ce13de02 (diff)
downloadHydroRoll-4838df315931bb883f704ec3e1abe2685f296cdf.tar.gz
HydroRoll-4838df315931bb883f704ec3e1abe2685f296cdf.zip
😀
Diffstat (limited to 'docs/components/image/ThemedImage.tsx')
-rw-r--r--docs/components/image/ThemedImage.tsx45
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/components/image/ThemedImage.tsx b/docs/components/image/ThemedImage.tsx
new file mode 100644
index 0000000..0416bd9
--- /dev/null
+++ b/docs/components/image/ThemedImage.tsx
@@ -0,0 +1,45 @@
+import React from "react";
+import Image from "next/image";
+
+export interface Image {
+ height: number;
+ width: number;
+ source: string;
+}
+
+export interface ThemedImageProps {
+ title?: string;
+ dark?: Image;
+ light?: Image;
+ priority?: boolean;
+}
+
+export function ThemedImage({
+ title,
+ light,
+ dark,
+ priority = false,
+}: ThemedImageProps) {
+ return (
+ <>
+ <div className="block w-full dark:hidden">
+ <Image
+ alt={title}
+ src={light.source}
+ width={light.width}
+ height={light.height}
+ priority={priority}
+ />
+ </div>
+ <div className="hidden w-full dark:block">
+ <Image
+ alt={title}
+ src={dark.source}
+ width={dark.width}
+ height={dark.height}
+ priority={priority}
+ />
+ </div>
+ </>
+ );
+}