diff --git a/infrastructure/eid-wallet/src/lib/ui/Button/ButtonSnippets.svelte b/infrastructure/eid-wallet/src/lib/ui/Button/Button.stories.snippet.svelte similarity index 100% rename from infrastructure/eid-wallet/src/lib/ui/Button/ButtonSnippets.svelte rename to infrastructure/eid-wallet/src/lib/ui/Button/Button.stories.snippet.svelte diff --git a/infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.stories.ts b/infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.stories.ts index bc7ad728..934b3f97 100644 --- a/infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.stories.ts +++ b/infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.stories.ts @@ -1,6 +1,6 @@ import type { ComponentProps } from "svelte"; +import { ButtonText } from "./Button.stories.snippet.svelte"; import ButtonAction from "./ButtonAction.svelte"; -import { ButtonText } from "./ButtonSnippets.svelte"; export default { title: "UI/ButtonAction", diff --git a/infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.svelte b/infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.svelte index 499a70c7..88f8a776 100644 --- a/infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.svelte +++ b/infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.svelte @@ -11,7 +11,7 @@ interface IButtonProps extends HTMLButtonAttributes { size?: "sm" | "md"; } -let { +const { variant = "solid", isLoading, callback, @@ -23,7 +23,7 @@ let { }: IButtonProps = $props(); let isSubmitting = $state(false); -let disabled = $derived(restProps.disabled || isLoading || isSubmitting); +const disabled = $derived(restProps.disabled || isLoading || isSubmitting); const handleClick = async () => { if (typeof callback !== "function") return; @@ -59,7 +59,7 @@ const sizeVariant = { md: "px-8 py-2.5 text-xl h-14", }; -let classes = $derived({ +const classes = $derived({ common: cn( "cursor-pointer w-min flex items-center justify-center rounded-full font-semibold duration-100", sizeVariant[size], diff --git a/infrastructure/eid-wallet/src/lib/ui/Button/ButtonIcon.stories.ts b/infrastructure/eid-wallet/src/lib/ui/Button/ButtonIcon.stories.ts new file mode 100644 index 00000000..d43d0d56 --- /dev/null +++ b/infrastructure/eid-wallet/src/lib/ui/Button/ButtonIcon.stories.ts @@ -0,0 +1,54 @@ +import { FlashlightIcon } from "@hugeicons/core-free-icons"; +import type { ComponentProps } from "svelte"; +import ButtonIcon from "./ButtonIcon.svelte"; + +export default { + title: "UI/ButtonIcon", + component: ButtonIcon, + tags: ["autodocs"], + render: (args: { + Component: ButtonIcon<{ icon: typeof FlashlightIcon }>; + props: ComponentProps; + }) => ({ + Component: ButtonIcon, + props: args, + }), +}; + +export const Default = { + render: () => ({ + Component: ButtonIcon, + props: { + variant: "white", + ariaLabel: "Default button", + size: "md", + icon: FlashlightIcon, + }, + }), +}; + +export const Loading = { + render: () => ({ + Component: ButtonIcon, + props: { + variant: "white", + ariaLabel: "Loading button", + size: "md", + icon: FlashlightIcon, + isLoading: true, + }, + }), +}; + +export const Active = { + render: () => ({ + Component: ButtonIcon, + props: { + variant: "white", + ariaLabel: "Active button", + size: "md", + icon: FlashlightIcon, + isActive: true, + }, + }), +}; diff --git a/infrastructure/eid-wallet/src/lib/ui/Button/ButtonIcon.svelte b/infrastructure/eid-wallet/src/lib/ui/Button/ButtonIcon.svelte index e69de29b..d99183a7 100644 --- a/infrastructure/eid-wallet/src/lib/ui/Button/ButtonIcon.svelte +++ b/infrastructure/eid-wallet/src/lib/ui/Button/ButtonIcon.svelte @@ -0,0 +1,165 @@ + + + + +