Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions libs/ui/src/atoms/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const buttonVariants = tv({
sm: "h-form-control-sm gap-button-sm rounded-button-sm p-button-sm text-button-sm",
md: "h-form-control-md gap-button-md rounded-button-md p-button-md text-button-md",
lg: "gap-button-lg rounded-button-lg p-button-lg text-button-lg",
content:
"min-h-form-control-md gap-button-md whitespace-normal break-words rounded-button-md p-button-md text-center text-button-md leading-button-content",
current: "gap-button-md text-inherit",
},
block: {
Expand Down Expand Up @@ -230,6 +232,11 @@ export const buttonVariants = tv({
size: "md",
className: "border-(length:--border-width-button-md)",
},
{
theme: "outlined",
size: "content",
className: "border-(length:--border-width-button-md)",
},
{
theme: "outlined",
size: "lg",
Expand Down
5 changes: 3 additions & 2 deletions libs/ui/src/atoms/link-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function LinkButton<T extends ElementType = "a">({
const handleClick = onClick as
| ((event: MouseEvent<Element>) => void)
| undefined
const resolvedIconSize = iconSize ?? (size === "content" ? "current" : size)

return (
<Link
Expand Down Expand Up @@ -90,11 +91,11 @@ export function LinkButton<T extends ElementType = "a">({
tabIndex={disabled ? -1 : tabIndex}
>
{icon && iconPosition === "left" && (
<Icon icon={icon} size={iconSize ?? size} />
<Icon icon={icon} size={resolvedIconSize} />
)}
{children}
{icon && iconPosition === "right" && (
<Icon icon={icon} size={iconSize ?? size} />
<Icon icon={icon} size={resolvedIconSize} />
)}
</Link>
)
Expand Down
2 changes: 2 additions & 0 deletions libs/ui/src/tokens/components/atoms/_button.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
* `p-button-{size}` utility. Figma exports the split `x` and `y`
* axes; this bridge composes them so the existing utility name keeps
* working without per-axis class churn.
* - Content button line-height for multiline CTA labels.
* - The `token-icon-button-spinner` semantic icon alias.
*/

@theme static {
--padding-button-sm: var(--padding-button-y-sm) var(--padding-button-x-sm);
--padding-button-md: var(--padding-button-y-md) var(--padding-button-x-md);
--padding-button-lg: var(--padding-button-y-lg) var(--padding-button-x-lg);
--leading-button-content: 1.25;
}

@utility token-icon-button-spinner {
Expand Down
5 changes: 4 additions & 1 deletion libs/ui/stories/atoms/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const meta: Meta<typeof Button> = {
},
size: {
control: 'select',
options: ['sm', 'md', 'lg', 'current'],
options: ['sm', 'md', 'lg', 'content', 'current'],
Comment thread
BleedingDev marked this conversation as resolved.
description: 'Controls the size of the button',
table: {
defaultValue: { summary: 'md' },
Expand Down Expand Up @@ -207,6 +207,9 @@ export const Sizes: Story = {
<Button size="sm">Small</Button>
<Button size="md">Medium</Button>
<Button size="lg">Large</Button>
<div className="w-3xs">
<Button size="content">Přineste AI engineering do týmu</Button>
</div>
</VariantGroup>

<VariantGroup title="Block buttons" fullWidth>
Expand Down
Loading