-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01f37c9
commit cad3f83
Showing
3 changed files
with
20 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<HTMLDivElement> { | ||
/** 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 | ||
* <Dots1 /> | ||
* | ||
* @source | ||
*/ | ||
export function Dots1({ children }: Dots1Props) { | ||
return <div className={styles.loader} data-testid="dots1" />; | ||
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 <div className={className} style={style} />; | ||
} |