UI/button: make children optional, fix layout shift
This commit is contained in:
@@ -39,7 +39,7 @@ const sizePaddings: Record<Size, string> = {
|
|||||||
interface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
interface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||||
variant?: Variants;
|
variant?: Variants;
|
||||||
size?: Size;
|
size?: Size;
|
||||||
children: JSX.Element;
|
children?: JSX.Element;
|
||||||
startIcon?: JSX.Element;
|
startIcon?: JSX.Element;
|
||||||
endIcon?: JSX.Element;
|
endIcon?: JSX.Element;
|
||||||
class?: string;
|
class?: string;
|
||||||
@@ -67,9 +67,9 @@ export const Button = (props: ButtonProps) => {
|
|||||||
)}
|
)}
|
||||||
{...other}
|
{...other}
|
||||||
>
|
>
|
||||||
<span class="h-4">{local.startIcon}</span>
|
{local.startIcon && <span class="h-4">{local.startIcon}</span>}
|
||||||
<span>{local.children}</span>
|
{local.children && <span>{local.children}</span>}
|
||||||
<span class="h-4">{local.endIcon}</span>
|
{local.endIcon && <span class="h-4">{local.endIcon}</span>}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user