UI/button: make children optional, fix layout shift

This commit is contained in:
Johannes Kirschbauer
2024-11-26 13:55:40 +01:00
parent 4aa83351b1
commit e3b4797ae1

View File

@@ -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>
); );
}; };