aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/components/image/ThemedImageFigure.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/ThemedImageFigure.tsx
parentdb74ade0234a40c2120ad5f2a41bee50ce13de02 (diff)
downloadHydroRoll-4838df315931bb883f704ec3e1abe2685f296cdf.tar.gz
HydroRoll-4838df315931bb883f704ec3e1abe2685f296cdf.zip
😀
Diffstat (limited to 'docs/components/image/ThemedImageFigure.tsx')
-rw-r--r--docs/components/image/ThemedImageFigure.tsx47
1 files changed, 47 insertions, 0 deletions
diff --git a/docs/components/image/ThemedImageFigure.tsx b/docs/components/image/ThemedImageFigure.tsx
new file mode 100644
index 0000000..9c50dc7
--- /dev/null
+++ b/docs/components/image/ThemedImageFigure.tsx
@@ -0,0 +1,47 @@
+import React from "react";
+import { ImageFigureProps } from "./ImageFigure";
+import { ThemedImage, ThemedImageProps } from "./ThemedImage";
+import cn from "classnames";
+export type ThemedImageFigureProps = Omit<ImageFigureProps, "src"> &
+ ThemedImageProps;
+
+export function ThemedImageFigure(
+ props: ThemedImageFigureProps
+): React.ReactNode {
+ const {
+ caption,
+ margin = 40,
+ captionSpacing = null,
+ shadow = false,
+ borderRadius = false,
+ ...rest
+ } = props;
+
+ return (
+ <figure
+ className="block -mx-4 text-center sm:-mx-4 md:-mx-7 lg:-mx-12"
+ style={{ marginTop: `${margin}px`, marginBottom: `${margin}px` }}
+ >
+ <div
+ className={cn(
+ "relative inline-block max-w-full overflow-hidden border-box text-[0px]",
+ {
+ "rounded-md": borderRadius,
+ "shadow-lg": shadow,
+ }
+ )}
+ >
+ {/* eslint-disable-next-line jsx-a11y/alt-text */}
+ <ThemedImage {...rest} />
+ </div>
+ {caption && (
+ <figcaption
+ className="m-0 text-xs text-center text-gray-500"
+ style={captionSpacing ? { marginTop: captionSpacing } : {}}
+ >
+ {caption}
+ </figcaption>
+ )}
+ </figure>
+ );
+}