refactor: consistent component props
This commit is contained in:
@@ -3,6 +3,18 @@
|
||||
type ButtonSize = "sm" | "md" | "lg";
|
||||
type ButtonType = "button" | "submit" | "reset";
|
||||
|
||||
interface Props {
|
||||
variant?: ButtonVariant;
|
||||
size?: ButtonSize;
|
||||
disabled?: boolean;
|
||||
type?: ButtonType;
|
||||
fullWidth?: boolean;
|
||||
loading?: boolean;
|
||||
class?: string;
|
||||
children?: any;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
let {
|
||||
variant = "primary",
|
||||
size = "md",
|
||||
@@ -13,17 +25,7 @@
|
||||
class: className = "",
|
||||
children,
|
||||
...restProps
|
||||
}: {
|
||||
variant?: ButtonVariant;
|
||||
size?: ButtonSize;
|
||||
disabled?: boolean;
|
||||
type?: ButtonType;
|
||||
fullWidth?: boolean;
|
||||
loading?: boolean;
|
||||
class?: string;
|
||||
children?: any;
|
||||
[key: string]: any;
|
||||
} = $props();
|
||||
}: Props = $props();
|
||||
</script>
|
||||
|
||||
<button
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
type IconButtonVariant = "primary" | "secondary" | "danger";
|
||||
type IconButtonSize = "sm" | "md" | "lg";
|
||||
|
||||
interface Props {
|
||||
variant?: IconButtonVariant;
|
||||
size?: IconButtonSize;
|
||||
disabled?: boolean;
|
||||
ariaLabel?: string;
|
||||
class?: string;
|
||||
children?: any;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
let {
|
||||
variant = "secondary",
|
||||
size = "md",
|
||||
@@ -10,15 +20,7 @@
|
||||
class: className = "",
|
||||
children,
|
||||
...restProps
|
||||
}: {
|
||||
variant?: IconButtonVariant;
|
||||
size?: IconButtonSize;
|
||||
disabled?: boolean;
|
||||
ariaLabel?: string;
|
||||
class?: string;
|
||||
children?: any;
|
||||
[key: string]: any;
|
||||
} = $props();
|
||||
}: Props = $props();
|
||||
</script>
|
||||
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user