From ee54493c41a9fdd42fd8865222ace84500deb1b3 Mon Sep 17 00:00:00 2001 From: Scott Dickerson <6663002+scottdickerson@users.noreply.github.com> Date: Fri, 3 Jan 2025 15:43:39 -0600 Subject: [PATCH] fix(button): font and image sizes are incorrect and non responsive --- src/components/Button/Button.stories.tsx | 6 ----- src/components/Button/Button.test.tsx | 4 +-- src/components/Button/Button.tsx | 7 ----- src/components/Button/_button.scss | 27 ++++--------------- src/patterns/ViewingsList/ViewingsList.tsx | 2 +- .../ViewingsList/ViewingsListCard.tsx | 25 +++-------------- 6 files changed, 10 insertions(+), 61 deletions(-) diff --git a/src/components/Button/Button.stories.tsx b/src/components/Button/Button.stories.tsx index 03743e37..d24ba32d 100644 --- a/src/components/Button/Button.stories.tsx +++ b/src/components/Button/Button.stories.tsx @@ -10,12 +10,6 @@ const meta = { component: Button, argTypes: { - size: { - options: ['sm', 'md', 'lg'], - control: { - type: 'select', - }, - }, variant: { options: Object.values(ButtonVariants), control: { diff --git a/src/components/Button/Button.test.tsx b/src/components/Button/Button.test.tsx index 73b05971..1b2018c7 100644 --- a/src/components/Button/Button.test.tsx +++ b/src/components/Button/Button.test.tsx @@ -15,20 +15,18 @@ describe('Button', () => { render(); const buttonElement = screen.getByText('Submit'); expect(buttonElement).toHaveClass(`${px}-button`); - expect(buttonElement).toHaveClass(`${px}-button--md`); expect(buttonElement).toHaveClass(`${px}-button--primary`); expect(buttonElement).not.toHaveClass(`${px}-button--icon-last`); }); it('renders with type and size classnames', () => { render( - , ); const buttonElement = screen.getByText('Cancel'); expect(buttonElement).toHaveClass(`${px}-button`); - expect(buttonElement).toHaveClass(`${px}-button--lg`); expect(buttonElement).toHaveClass(`${px}-button--secondary`); expect(buttonElement).toHaveClass(`${px}-button--icon-last`); }); diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index 9b591964..787e8a44 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -21,10 +21,6 @@ export interface ButtonProps extends React.HTMLAttributes( ( { variant = ButtonVariants.primary, - size = 'md', children, className, isIconLast: iconLast = false, @@ -78,7 +73,6 @@ const Button = forwardRef( href={href} className={classnames( `${baseClassName}`, - `${baseClassName}--${size}`, `${baseClassName}--${variant}`, { [`${baseClassName}--icon-last`]: iconLast, @@ -99,7 +93,6 @@ const Button = forwardRef( type={type} className={classnames( `${baseClassName}`, - `${baseClassName}--${size}`, `${baseClassName}--${variant}`, { [`${baseClassName}--icon-last`]: iconLast, diff --git a/src/components/Button/_button.scss b/src/components/Button/_button.scss index 4d8d553d..20072e02 100644 --- a/src/components/Button/_button.scss +++ b/src/components/Button/_button.scss @@ -2,6 +2,7 @@ .#{$px}-button { @include bodyText; + @include labelText($button); align-items: center; background-color: $pure-black; @@ -12,6 +13,7 @@ display: inline-flex; font-variation-settings: 'wght' 600; gap: $margin-xsm; + height: $spacing-lg; justify-content: center; padding: 0 $padding-md; position: relative; @@ -21,6 +23,8 @@ svg { fill: $pure-white; + height: $button-label-line-height; + width: $button-label-line-height; path { fill: $pure-white; @@ -45,27 +49,6 @@ } } - &--sm { - font-size: 0.75rem; - height: 44px; - - svg { - height: 1rem; - width: 1rem; - } - } - - &--md, - &--lg { - font-size: 1rem; - height: 48px; - - svg { - height: 1.25rem; - width: 1.25rem; - } - } - &--link { background-color: transparent; border: 0; @@ -146,7 +129,7 @@ background-color: transparent; border: 0; color: $pure-black; - height: 28px; + height: $spacing-md; padding: 0; svg { diff --git a/src/patterns/ViewingsList/ViewingsList.tsx b/src/patterns/ViewingsList/ViewingsList.tsx index 0803e1e3..f92ca3e8 100644 --- a/src/patterns/ViewingsList/ViewingsList.tsx +++ b/src/patterns/ViewingsList/ViewingsList.tsx @@ -138,7 +138,7 @@ const ViewingsList = ({ onSave={handleOnSave} /> ))} - diff --git a/src/patterns/ViewingsList/ViewingsListCard.tsx b/src/patterns/ViewingsList/ViewingsListCard.tsx index a633ca61..55c8c50d 100644 --- a/src/patterns/ViewingsList/ViewingsListCard.tsx +++ b/src/patterns/ViewingsList/ViewingsListCard.tsx @@ -273,41 +273,22 @@ const ViewingsListCard = ({
{editState ? ( <> - - ) : ( <> -