Skip to content

Commit bc01c2c

Browse files
committed
fix: Check Format / lint
1 parent 6c6ffbf commit bc01c2c

File tree

6 files changed

+168
-169
lines changed

6 files changed

+168
-169
lines changed

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

Lines changed: 65 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,78 @@
11
<script lang="ts">
2-
import { cn } from "$lib/utils";
3-
import type { HTMLButtonAttributes } from "svelte/elements";
2+
import { cn } from "$lib/utils";
3+
import type { HTMLButtonAttributes } from "svelte/elements";
44
5-
interface IButtonProps extends HTMLButtonAttributes {
6-
variant?: "solid" | "soft" | "danger" | "danger-soft" | "white";
7-
isLoading?: boolean;
8-
callback?: () => Promise<void>;
9-
blockingClick?: boolean;
10-
type?: "button" | "submit" | "reset";
11-
size?: "sm" | "md";
12-
}
5+
interface IButtonProps extends HTMLButtonAttributes {
6+
variant?: "solid" | "soft" | "danger" | "danger-soft" | "white";
7+
isLoading?: boolean;
8+
callback?: () => Promise<void>;
9+
blockingClick?: boolean;
10+
type?: "button" | "submit" | "reset";
11+
size?: "sm" | "md";
12+
}
1313
14-
let {
15-
variant = "solid",
16-
isLoading,
17-
callback,
18-
blockingClick,
19-
type = "button",
20-
size = "md",
21-
children = undefined,
22-
...restProps
23-
}: IButtonProps = $props();
14+
let {
15+
variant = "solid",
16+
isLoading,
17+
callback,
18+
blockingClick,
19+
type = "button",
20+
size = "md",
21+
children = undefined,
22+
...restProps
23+
}: IButtonProps = $props();
2424
25-
let isSubmitting = $state(false);
26-
let disabled = $derived(restProps.disabled || isLoading || isSubmitting);
25+
let isSubmitting = $state(false);
26+
let disabled = $derived(restProps.disabled || isLoading || isSubmitting);
2727
28-
const handleClick = async () => {
29-
if (typeof callback !== "function") return;
28+
const handleClick = async () => {
29+
if (typeof callback !== "function") return;
3030
31-
if (blockingClick) isSubmitting = true;
32-
try {
33-
await callback();
34-
} catch (error) {
35-
console.error("Error in button callback:", error);
36-
} finally {
37-
isSubmitting = false;
38-
}
39-
};
31+
if (blockingClick) isSubmitting = true;
32+
try {
33+
await callback();
34+
} catch (error) {
35+
console.error("Error in button callback:", error);
36+
} finally {
37+
isSubmitting = false;
38+
}
39+
};
4040
41-
const variantClasses = {
42-
solid: { background: "bg-primary-500", text: "text-white" },
43-
soft: { background: "bg-primary-100", text: "text-primary-500" },
44-
danger: { background: "bg-danger-500", text: "text-white" },
45-
"danger-soft": { background: "bg-danger-100", text: "text-danger-500" },
46-
white: { background: "bg-white", text: "text-black" },
47-
};
41+
const variantClasses = {
42+
solid: { background: "bg-primary-500", text: "text-white" },
43+
soft: { background: "bg-primary-100", text: "text-primary-500" },
44+
danger: { background: "bg-danger-500", text: "text-white" },
45+
"danger-soft": { background: "bg-danger-100", text: "text-danger-500" },
46+
white: { background: "bg-white", text: "text-black" },
47+
};
4848
49-
const disabledVariantClasses = {
50-
solid: { background: "bg-primary-300", text: "text-white" },
51-
soft: { background: "bg-primary-100", text: "text-primary-300" },
52-
danger: { background: "bg-danger-400", text: "text-white" },
53-
"danger-soft": { background: "bg-danger-100", text: "text-danger-400" },
54-
white: { background: "bg-black-100", text: "text-black-700" },
55-
};
49+
const disabledVariantClasses = {
50+
solid: { background: "bg-primary-300", text: "text-white" },
51+
soft: { background: "bg-primary-100", text: "text-primary-300" },
52+
danger: { background: "bg-danger-400", text: "text-white" },
53+
"danger-soft": { background: "bg-danger-100", text: "text-danger-400" },
54+
white: { background: "bg-black-100", text: "text-black-700" },
55+
};
5656
57-
const sizeVariant = {
58-
sm: "px-4 py-1.5 text-base h-11",
59-
md: "px-8 py-2.5 text-xl h-14",
60-
};
57+
const sizeVariant = {
58+
sm: "px-4 py-1.5 text-base h-11",
59+
md: "px-8 py-2.5 text-xl h-14",
60+
};
6161
62-
let classes = $derived({
63-
common: cn(
64-
"cursor-pointer w-min flex items-center justify-center rounded-full font-semibold duration-100",
65-
sizeVariant[size]
66-
),
67-
background: disabled
68-
? disabledVariantClasses[variant].background ||
69-
variantClasses[variant].background
70-
: variantClasses[variant].background,
71-
text: disabled
72-
? disabledVariantClasses[variant].text ||
73-
variantClasses[variant].text
74-
: variantClasses[variant].text,
75-
disabled: "cursor-not-allowed",
76-
});
62+
let classes = $derived({
63+
common: cn(
64+
"cursor-pointer w-min flex items-center justify-center rounded-full font-semibold duration-100",
65+
sizeVariant[size],
66+
),
67+
background: disabled
68+
? disabledVariantClasses[variant].background ||
69+
variantClasses[variant].background
70+
: variantClasses[variant].background,
71+
text: disabled
72+
? disabledVariantClasses[variant].text || variantClasses[variant].text
73+
: variantClasses[variant].text,
74+
disabled: "cursor-not-allowed",
75+
});
7776
</script>
7877

7978
<button

infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.stories.snippet.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script context="module">
2-
export { InnerContent };
2+
export { InnerContent };
33
</script>
44

55
{#snippet InnerContent()}

infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.stories.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { InnerContent } from "./Drawer.stories.snippet.svelte";
33
import Drawer from "./Drawer.svelte";
44

55
export default {
6-
title: "UI/Drawer",
7-
component: Drawer,
8-
tags: ["autodocs"],
9-
render: (args: { isPaneOpen: boolean; children: Snippet }) => ({
10-
Component: Drawer,
11-
props: args,
12-
}),
6+
title: "UI/Drawer",
7+
component: Drawer,
8+
tags: ["autodocs"],
9+
render: (args: { isPaneOpen: boolean; children: Snippet }) => ({
10+
Component: Drawer,
11+
props: args,
12+
}),
1313
};
1414

1515
export const Default = {
16-
args: {
17-
isPaneOpen: true,
18-
children: InnerContent,
19-
},
16+
args: {
17+
isPaneOpen: true,
18+
children: InnerContent,
19+
},
2020
};

infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
11
<script lang="ts">
2-
import { clickOutside, cn } from "$lib/utils";
3-
import { CupertinoPane } from "cupertino-pane";
4-
import { type Snippet } from "svelte";
5-
import { swipe } from "svelte-gestures";
6-
import type { HTMLAttributes } from "svelte/elements";
2+
import { clickOutside, cn } from "$lib/utils";
3+
import { CupertinoPane } from "cupertino-pane";
4+
import { type Snippet } from "svelte";
5+
import { swipe } from "svelte-gestures";
6+
import type { HTMLAttributes } from "svelte/elements";
77
8-
interface IDrawerProps extends HTMLAttributes<HTMLDivElement> {
9-
isPaneOpen?: boolean;
10-
isCancelRequired?: boolean;
11-
children?: Snippet;
12-
handleSwipe?: (isOpen: boolean | undefined) => void;
13-
}
8+
interface IDrawerProps extends HTMLAttributes<HTMLDivElement> {
9+
isPaneOpen?: boolean;
10+
isCancelRequired?: boolean;
11+
children?: Snippet;
12+
handleSwipe?: (isOpen: boolean | undefined) => void;
13+
}
1414
15-
let drawerElem: HTMLDivElement;
16-
let pane: CupertinoPane;
15+
let drawerElem: HTMLDivElement;
16+
let pane: CupertinoPane;
1717
18-
let {
19-
isPaneOpen = $bindable(),
20-
isCancelRequired = false,
21-
children = undefined,
22-
handleSwipe,
23-
...restProps
24-
}: IDrawerProps = $props();
18+
let {
19+
isPaneOpen = $bindable(),
20+
isCancelRequired = false,
21+
children = undefined,
22+
handleSwipe,
23+
...restProps
24+
}: IDrawerProps = $props();
2525
26-
const handleClickOutside = () => {
27-
pane?.destroy({ animate: true });
28-
isPaneOpen = false;
29-
};
26+
const handleClickOutside = () => {
27+
pane?.destroy({ animate: true });
28+
isPaneOpen = false;
29+
};
3030
31-
$effect(() => {
32-
if (!drawerElem) return;
33-
pane = new CupertinoPane(drawerElem, {
34-
fitHeight: true,
35-
backdrop: true,
36-
backdropOpacity: 0.5,
37-
backdropBlur: true,
38-
bottomClose: true,
39-
buttonDestroy: isCancelRequired,
40-
showDraggable: true,
41-
upperThanTop: true,
42-
breaks: {
43-
bottom: { enabled: true, height: 250 },
44-
},
45-
initialBreak: "bottom",
46-
});
31+
$effect(() => {
32+
if (!drawerElem) return;
33+
pane = new CupertinoPane(drawerElem, {
34+
fitHeight: true,
35+
backdrop: true,
36+
backdropOpacity: 0.5,
37+
backdropBlur: true,
38+
bottomClose: true,
39+
buttonDestroy: isCancelRequired,
40+
showDraggable: true,
41+
upperThanTop: true,
42+
breaks: {
43+
bottom: { enabled: true, height: 250 },
44+
},
45+
initialBreak: "bottom",
46+
});
4747
48-
if (isPaneOpen) {
49-
pane.present({ animate: true });
50-
} else {
51-
pane.destroy({ animate: true });
52-
}
48+
if (isPaneOpen) {
49+
pane.present({ animate: true });
50+
} else {
51+
pane.destroy({ animate: true });
52+
}
5353
54-
return () => pane.destroy();
55-
});
54+
return () => pane.destroy();
55+
});
5656
57-
$effect(() => {
58-
if (isPaneOpen) {
59-
pane.present({ animate: true });
60-
} else {
61-
pane.destroy({ animate: true });
62-
}
63-
drawerElem.addEventListener("click_outside", () => {
64-
handleClickOutside();
65-
});
66-
});
57+
$effect(() => {
58+
if (isPaneOpen) {
59+
pane.present({ animate: true });
60+
} else {
61+
pane.destroy({ animate: true });
62+
}
63+
drawerElem.addEventListener("click_outside", () => {
64+
handleClickOutside();
65+
});
66+
});
6767
</script>
6868

6969
<div
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
import type { ComponentProps } from "svelte";
22
import Selector from "./Selector.svelte";
33
import {
4-
BasicContent,
5-
WithIconContent,
4+
BasicContent,
5+
WithIconContent,
66
} from "./Selector.stories.snippet.svelte";
77

88
export default {
9-
title: "UI/Selector",
10-
component: Selector,
11-
tags: ["autodocs"],
12-
render: (args: {
13-
Component: Selector;
14-
props: ComponentProps<typeof Selector>;
15-
}) => ({
16-
Component: Selector,
17-
props: args,
18-
}),
9+
title: "UI/Selector",
10+
component: Selector,
11+
tags: ["autodocs"],
12+
render: (args: {
13+
Component: Selector;
14+
props: ComponentProps<typeof Selector>;
15+
}) => ({
16+
Component: Selector,
17+
props: args,
18+
}),
1919
};
2020

2121
export const WithIcon = {
22-
render: () => ({
23-
Component: Selector,
24-
props: {
25-
id: "option-1",
26-
name: "lang",
27-
value: "option-1",
28-
selected: "option-1",
29-
icon: WithIconContent,
30-
children: BasicContent,
31-
},
32-
}),
22+
render: () => ({
23+
Component: Selector,
24+
props: {
25+
id: "option-1",
26+
name: "lang",
27+
value: "option-1",
28+
selected: "option-1",
29+
icon: WithIconContent,
30+
children: BasicContent,
31+
},
32+
}),
3333
};
3434

3535
export const WithoutIcon = {
36-
render: () => ({
37-
Component: Selector,
38-
props: {
39-
id: "option-1",
40-
name: "lang",
41-
value: "option-1",
42-
selected: "option-1",
43-
children: BasicContent,
44-
},
45-
}),
36+
render: () => ({
37+
Component: Selector,
38+
props: {
39+
id: "option-1",
40+
name: "lang",
41+
value: "option-1",
42+
selected: "option-1",
43+
children: BasicContent,
44+
},
45+
}),
4646
};

infrastructure/eid-wallet/src/lib/utils/mergeClasses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { type ClassValue, clsx } from "clsx";
22
import { twMerge } from "tailwind-merge";
33

44
export function cn(...inputs: ClassValue[]) {
5-
return twMerge(clsx(inputs));
5+
return twMerge(clsx(inputs));
66
}

0 commit comments

Comments
 (0)