From b5bb785a807824640356b0329b3cff2be2351191 Mon Sep 17 00:00:00 2001 From: Jared White Date: Mon, 7 Aug 2023 12:37:10 -0700 Subject: [PATCH] fix: update `text` variant of Button to align with design (#58) * fix: update `text` variant of Button to align with design * chore: improve button size styles * docs: update size description --- src/actions/Button.scss | 26 ++++++++++++++++------ src/actions/Button.tsx | 6 ++--- src/actions/__stories__/Button.stories.tsx | 24 ++++++++++---------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/actions/Button.scss b/src/actions/Button.scss index f0252be..66e5a87 100644 --- a/src/actions/Button.scss +++ b/src/actions/Button.scss @@ -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; @@ -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); @@ -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"]) { @@ -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); } diff --git a/src/actions/Button.tsx b/src/actions/Button.tsx index 55d6fe7..0eaa352 100644 --- a/src/actions/Button.tsx +++ b/src/actions/Button.tsx @@ -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 @@ -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, diff --git a/src/actions/__stories__/Button.stories.tsx b/src/actions/__stories__/Button.stories.tsx index bf7e7b4..993db99 100644 --- a/src/actions/__stories__/Button.stories.tsx +++ b/src/actions/__stories__/Button.stories.tsx @@ -145,24 +145,24 @@ export const buttonsWithIcons = () => ( ) -export const buttonsBorderlessText = () => ( +export const textButtons = () => ( <> -
- -
-
- {" "} - -
+ )