No margin-right on button icon if no text

This commit is contained in:
Kalle 2022-05-27 22:34:41 +03:00
parent 065c68e794
commit 6cd5225ceb
2 changed files with 9 additions and 2 deletions

View File

@ -47,7 +47,10 @@ export function Button(props: ButtonProps) {
type={type}
{...rest}
>
{icon && React.cloneElement(icon, { className: "button-icon" })}
{icon &&
React.cloneElement(icon, {
className: clsx("button-icon", { lonely: !children }),
})}
{loading && loadingText ? loadingText : children}
</button>
);

View File

@ -186,11 +186,15 @@ a {
opacity: 0.6;
}
:is(button, .button) > .button-icon {
.button-icon {
width: 1.25rem;
margin-inline-end: var(--s-1-5);
}
.button-icon.lonely {
margin-inline-end: 0;
}
:is(button, .button).tiny > .button-icon {
width: 1rem;
margin-inline-end: var(--s-1);