This commit is contained in:
Hk-Gosuto
2024-03-24 11:42:06 +08:00
parent 428bf81801
commit a18cb2c525
12 changed files with 112 additions and 18 deletions

View File

@@ -4,6 +4,8 @@ import styles from "./button.module.scss";
export type ButtonType = "primary" | "danger" | null;
import LoadingIcon from "../icons/three-dots-white.svg";
export function IconButton(props: {
onClick?: () => void;
icon?: JSX.Element;
@@ -16,6 +18,7 @@ export function IconButton(props: {
disabled?: boolean;
tabIndex?: number;
autoFocus?: boolean;
loding?: boolean;
}) {
return (
<button
@@ -32,7 +35,7 @@ export function IconButton(props: {
tabIndex={props.tabIndex}
autoFocus={props.autoFocus}
>
{props.icon && (
{props.icon && !props.loding && (
<div
className={
styles["icon-button-icon"] +
@@ -43,9 +46,19 @@ export function IconButton(props: {
</div>
)}
{props.text && (
{props.text && !props.loding && (
<div className={styles["icon-button-text"]}>{props.text}</div>
)}
{props.loding ? (
<div
className={
styles["icon-button-loading-icon"] +
` ${props.type === "primary" && "no-dark"}`
}
>
<LoadingIcon />
</div>
) : null}
</button>
);
}