Skip to content

Commit

Permalink
fix: update text variant of Button to align with design (#58)
Browse files Browse the repository at this point in the history
* fix: update `text` variant of Button to align with design

* chore: improve button size styles

* docs: update size description
  • Loading branch information
jaredcwhite authored Aug 7, 2023
1 parent af7c7c5 commit b5bb785
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
26 changes: 19 additions & 7 deletions src/actions/Button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@
all: initial;
display: inline-flex;
gap: var(--button-interior-gap);
padding: var(--button-padding-md);
border-style: solid;
border-width: var(--button-border-width);
border-radius: var(--button-border-radius-md);
font-family: var(--button-font-family);
font-weight: var(--button-font-weight);
font-size: var(--button-font-size-md);
line-height: var(--seeds-line-height-tight);
cursor: pointer;

Expand All @@ -38,6 +35,12 @@
border-radius: var(--button-border-radius-sm);
}

&[data-size="md"] {
padding: var(--button-padding-md);
font-size: var(--button-font-size-md);
border-radius: var(--button-border-radius-md);
}

&[data-size="lg"] {
padding: var(--button-padding-lg);
font-size: var(--button-font-size-lg);
Expand Down Expand Up @@ -135,13 +138,22 @@
}
}

&[data-variant="borderless-text"] {
&[data-variant="text"] {
background-color: transparent;
border-color: transparent;
border: none;
color: var(--seeds-color-primary);
font-weight: normal;
text-decoration: underline;
gap: var(--seeds-s1);

&[data-size] {
padding: 0;
border-radius: 0;
}

&[data-size="lg"] {
font-size: var(--button-font-size-md);
}
}

&:not([data-variant$="-outlined"]) {
Expand All @@ -162,11 +174,11 @@
}
}

&.has-lead-icon {
&.has-lead-icon:not([data-variant="text"]) {
padding-inline-start: var(--button-icon-side-padding);
}

&.has-tail-icon {
&.has-tail-icon:not([data-variant="text"]) {
padding-inline-end: var(--button-icon-side-padding);
}

Expand Down
6 changes: 3 additions & 3 deletions src/actions/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export interface ButtonProps {
| "alert-outlined"
| "highlight"
| "highlight-outlined"
| "borderless-text"
/** Button size */
| "text"
/** Button size (only `sm`/`md` supported by `text` variant) */
size?: "sm" | "md" | "lg"
/** Icon to show before the label text */
leadIcon?: React.ReactNode
Expand Down Expand Up @@ -66,7 +66,7 @@ const setupButtonProps = (props: ButtonProps) => {
return {
updatedProps: {
"data-variant": props.variant || "primary",
"data-size": props.size,
"data-size": props.size || "md",
id: props.id,
className: classNames.join(" "),
"aria-label": props.ariaLabel,
Expand Down
24 changes: 12 additions & 12 deletions src/actions/__stories__/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,24 +145,24 @@ export const buttonsWithIcons = () => (
</div>
)

export const buttonsBorderlessText = () => (
export const textButtons = () => (
<>
<div style={{ display: "flex", gap: "1rem" }}>
<Button variant="borderless-text" leadIcon={<Icon icon={faHeart} />}>
Lead Icon
<div style={{ display: "flex", gap: "1rem", marginBlockEnd: "1rem" }}>
<Button variant="text">
Medium Size
</Button>
<Button variant="borderless-text" tailIcon={<Icon icon={faHeart} />}>
Tail Icon
<Button variant="text" size="sm">
Small Size
</Button>
</div>
<div>
{" "}
<Button variant="borderless-text" size="sm">
Small Size
<div style={{ display: "flex", gap: "1rem" }}>
<Button variant="text" leadIcon={<Icon icon={faHeart} />}>
Lead Icon
</Button>
<Button variant="borderless-text" size="lg">
Large Size
<Button variant="text" tailIcon={<Icon icon={faHeart} />}>
Tail Icon
</Button>
</div>

</>
)

0 comments on commit b5bb785

Please sign in to comment.