From 4838df315931bb883f704ec3e1abe2685f296cdf Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Sat, 22 Apr 2023 19:52:26 +0800 Subject: 😀 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/components/image/ImageFigure.tsx | 40 ++++++++++++++++++++++++ docs/components/image/ThemedImage.tsx | 45 +++++++++++++++++++++++++++ docs/components/image/ThemedImageFigure.tsx | 47 +++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 docs/components/image/ImageFigure.tsx create mode 100644 docs/components/image/ThemedImage.tsx create mode 100644 docs/components/image/ThemedImageFigure.tsx (limited to 'docs/components/image') diff --git a/docs/components/image/ImageFigure.tsx b/docs/components/image/ImageFigure.tsx new file mode 100644 index 0000000..b90237e --- /dev/null +++ b/docs/components/image/ImageFigure.tsx @@ -0,0 +1,40 @@ +import React from "react"; +import Image from "next/image"; + +type ImageProps = Parameters[0]; + +export type ImageFigureProps = ImageProps & { + caption?: string; + margin?: number; + captionSpacing?: number; + shadow?: boolean; + borderRadius?: boolean; +}; + +export function ImageFigure(props: ImageFigureProps): React.ReactNode { + const { + caption, + margin = 40, + captionSpacing = null, + shadow = false, + borderRadius = false, + ...rest + } = props; + + return ( +
+
+ {/* eslint-disable-next-line jsx-a11y/alt-text */} + +
+ {caption && ( +
+ {caption} +
+ )} +
+ ); +} 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 ( + <> +
+ {title} +
+
+ {title} +
+ + ); +} 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 & + ThemedImageProps; + +export function ThemedImageFigure( + props: ThemedImageFigureProps +): React.ReactNode { + const { + caption, + margin = 40, + captionSpacing = null, + shadow = false, + borderRadius = false, + ...rest + } = props; + + return ( +
+
+ {/* eslint-disable-next-line jsx-a11y/alt-text */} + +
+ {caption && ( +
+ {caption} +
+ )} +
+ ); +} -- cgit v1.2.3-70-g09d2