Skip to content

Commit 05f586e

Browse files
committed
feat: polish button icon (and button action too)
1 parent 90ff7e4 commit 05f586e

File tree

5 files changed

+170
-179
lines changed

5 files changed

+170
-179
lines changed
File renamed without changes.
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
import type { ComponentProps } from "svelte";
22
import ButtonAction from "./ButtonAction.svelte";
3-
import { ButtonText } from "./ButtonSnippets.svelte";
3+
import { ButtonText } from "./Button.stories.snippet.svelte";
44

55
export default {
6-
title: "UI/ButtonAction",
7-
component: ButtonAction,
8-
tags: ["autodocs"],
9-
render: (args: {
10-
Component: ButtonAction;
11-
props: ComponentProps<typeof ButtonAction>;
12-
}) => ({
13-
Component: ButtonAction,
14-
props: args,
15-
}),
6+
title: "UI/ButtonAction",
7+
component: ButtonAction,
8+
tags: ["autodocs"],
9+
render: (args: {
10+
Component: ButtonAction;
11+
props: ComponentProps<typeof ButtonAction>;
12+
}) => ({
13+
Component: ButtonAction,
14+
props: args,
15+
}),
1616
};
1717

1818
export const Solid = {
19-
args: { variant: "solid", children: ButtonText },
19+
args: { variant: "solid", children: ButtonText },
2020
};
2121

2222
export const Soft = {
23-
args: { variant: "soft", children: ButtonText },
23+
args: { variant: "soft", children: ButtonText },
2424
};
2525

2626
export const Danger = {
27-
args: { variant: "danger", children: ButtonText },
27+
args: { variant: "danger", children: ButtonText },
2828
};
2929

3030
export const DangerSoft = {
31-
args: { variant: "danger-soft", children: ButtonText },
31+
args: { variant: "danger-soft", children: ButtonText },
3232
};
3333

3434
export const Loading = {
35-
args: { isLoading: true, children: ButtonText },
35+
args: { isLoading: true, children: ButtonText },
3636
};
3737

3838
export const BlockingClick = {
39-
args: {
40-
blockingClick: true,
41-
children: ButtonText,
42-
callback: async () => {
43-
await new Promise((resolve) => setTimeout(resolve, 2000));
44-
},
45-
},
39+
args: {
40+
blockingClick: true,
41+
children: ButtonText,
42+
callback: async () => {
43+
await new Promise((resolve) => setTimeout(resolve, 2000));
44+
},
45+
},
4646
};

infrastructure/eid-wallet/src/lib/ui/Button/ButtonAction.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface IButtonProps extends HTMLButtonAttributes {
1111
size?: "sm" | "md";
1212
}
1313
14-
let {
14+
const {
1515
variant = "solid",
1616
isLoading,
1717
callback,
@@ -23,7 +23,7 @@ let {
2323
}: IButtonProps = $props();
2424
2525
let isSubmitting = $state(false);
26-
let disabled = $derived(restProps.disabled || isLoading || isSubmitting);
26+
const disabled = $derived(restProps.disabled || isLoading || isSubmitting);
2727
2828
const handleClick = async () => {
2929
if (typeof callback !== "function") return;
@@ -59,7 +59,7 @@ const sizeVariant = {
5959
md: "px-8 py-2.5 text-xl h-14",
6060
};
6161
62-
let classes = $derived({
62+
const classes = $derived({
6363
common: cn(
6464
"cursor-pointer w-min flex items-center justify-center rounded-full font-semibold duration-100",
6565
sizeVariant[size],
Lines changed: 46 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,54 @@
1-
import ButtonIcon from './ButtonIcon.svelte'
2-
import { FlashlightIcon } from '@hugeicons/core-free-icons'
3-
import type { ComponentProps } from 'svelte'
1+
import ButtonIcon from "./ButtonIcon.svelte";
2+
import { FlashlightIcon } from "@hugeicons/core-free-icons";
3+
import type { ComponentProps } from "svelte";
44

55
export default {
6-
title: 'UI/ButtonIcon',
7-
component: ButtonIcon,
8-
tags: ['autodocs'],
9-
10-
parameters: {
11-
backgrounds: { default: 'dark' },
12-
},
13-
render: (args: {
14-
Component: ButtonIcon<{
15-
variant: 'white'
16-
ariaLabel: 'Default button'
17-
size: 'md'
18-
icon: typeof FlashlightIcon
19-
}>
20-
props: ComponentProps<typeof ButtonIcon>
21-
}) => ({
22-
Component: ButtonIcon,
23-
props: args,
24-
}),
25-
}
6+
title: "UI/ButtonIcon",
7+
component: ButtonIcon,
8+
tags: ["autodocs"],
9+
render: (args: {
10+
Component: ButtonIcon<{ icon: typeof FlashlightIcon }>;
11+
props: ComponentProps<typeof ButtonIcon>;
12+
}) => ({
13+
Component: ButtonIcon,
14+
props: args,
15+
}),
16+
};
2617

2718
export const Default = {
28-
render: () => ({
29-
Component: ButtonIcon,
30-
props: {
31-
variant: 'white',
32-
ariaLabel: 'Default button',
33-
size: 'md',
34-
icon: FlashlightIcon,
35-
},
36-
}),
37-
}
19+
render: () => ({
20+
Component: ButtonIcon,
21+
props: {
22+
variant: "white",
23+
ariaLabel: "Default button",
24+
size: "md",
25+
icon: FlashlightIcon,
26+
},
27+
}),
28+
};
3829

3930
export const Loading = {
40-
render: () => ({
41-
Component: ButtonIcon,
42-
props: {
43-
variant: 'white',
44-
ariaLabel: 'Loading button',
45-
size: 'md',
46-
icon: FlashlightIcon,
47-
isLoading: true,
48-
},
49-
}),
50-
}
31+
render: () => ({
32+
Component: ButtonIcon,
33+
props: {
34+
variant: "white",
35+
ariaLabel: "Loading button",
36+
size: "md",
37+
icon: FlashlightIcon,
38+
isLoading: true,
39+
},
40+
}),
41+
};
5142

5243
export const Active = {
53-
render: () => ({
54-
Component: ButtonIcon,
55-
props: {
56-
variant: 'white',
57-
ariaLabel: 'Active button',
58-
size: 'md',
59-
icon: FlashlightIcon,
60-
isActive: true,
61-
},
62-
}),
63-
}
44+
render: () => ({
45+
Component: ButtonIcon,
46+
props: {
47+
variant: "white",
48+
ariaLabel: "Active button",
49+
size: "md",
50+
icon: FlashlightIcon,
51+
isActive: true,
52+
},
53+
}),
54+
};

0 commit comments

Comments
 (0)