diff --git a/examples/admin/src/app/index.tsx b/examples/admin/src/app/index.tsx index 6b7598e4..9a0d00fc 100644 --- a/examples/admin/src/app/index.tsx +++ b/examples/admin/src/app/index.tsx @@ -9,7 +9,7 @@ function App(): JSX.Element { Admin
Kitchen Sink - + ); diff --git a/lib/src/server/dots/dots1/dots1.module.scss b/lib/src/server/dots/dots1/dots1.module.scss index 49133a52..c84414f9 100644 --- a/lib/src/server/dots/dots1/dots1.module.scss +++ b/lib/src/server/dots/dots1/dots1.module.scss @@ -1,8 +1,10 @@ /* HTML:
*/ .loader { + --c: #000; width: 60px; aspect-ratio: 4; - background: radial-gradient(circle closest-side, #000 90%, #0000) 0 / calc(100% / 3) 100% space; + background: radial-gradient(circle closest-side, var(--c) 90%, #0000) 0 / calc(100% / 3) 100% + space; clip-path: inset(0 100% 0 0); animation: anim 1s steps(4) infinite; } diff --git a/lib/src/server/dots/dots1/dots1.tsx b/lib/src/server/dots/dots1/dots1.tsx index e44de817..e0fc20e4 100644 --- a/lib/src/server/dots/dots1/dots1.tsx +++ b/lib/src/server/dots/dots1/dots1.tsx @@ -1,14 +1,25 @@ import * as React from "react"; import styles from "./dots1.module.scss"; -interface Dots1Props { - children?: React.ReactNode; +interface Dots1Props extends React.HTMLAttributes { + /** width of the loader element in pixels or a string with a length unit. */ + width?: number | string; + /** Color of the dots - CSS compatible color */ + color?: string; } /** - * # Dots1 * A simple loader with 3 dots. + * + * @example + * + * + * @source */ -export function Dots1({ children }: Dots1Props) { - return
; +export function Dots1({ width, color = "#000", ...props }: Dots1Props) { + let w = props.style?.width ?? width ?? 32; + w = typeof width === "string" ? width : `${width}px`; + const className = [styles.loader, props.className].filter(Boolean).join(" "); + const style = { ...(props.style ?? {}), width: w, "--c": color }; + return
; }