Skip to content

Commit

Permalink
Merge pull request #248 from MetroStar/big-button-updates
Browse files Browse the repository at this point in the history
Big Button Updates
  • Loading branch information
jbouder authored Aug 26, 2024
2 parents e2e1260 + 40f2189 commit 20d816d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/comet-uswds/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metrostar/comet-uswds",
"version": "3.0.1",
"version": "3.1.0",
"description": "React with TypeScript Component Library based on USWDS 3.0.",
"license": "Apache-2.0",
"main": "./dist/cjs/index.js",
Expand Down
2 changes: 2 additions & 0 deletions packages/comet-uswds/src/components/button/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const meta: Meta<typeof Button> = {
id: { required: true },
type: { control: 'select', required: true },
variant: { control: 'select' },
size: { control: 'select' },
disabled: { control: 'boolean' },
},
};
Expand All @@ -22,6 +23,7 @@ Default.args = {
id: 'button-1',
type: 'button',
variant: 'default',
size: 'default',
className: '',
disabled: false,
};
10 changes: 5 additions & 5 deletions packages/comet-uswds/src/components/button/button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ describe('Button', () => {
expect(screen.getByTestId('button')).toHaveClass('usa-button--inverse');
});

test('should render a big button', () => {
render(<Button id="button" variant="big"></Button>);
expect(screen.getByTestId('button')).toHaveClass('usa-button--big');
});

test('should render a unstyled button', () => {
render(<Button id="button" variant="unstyled"></Button>);
expect(screen.getByTestId('button')).toHaveClass('usa-button--unstyled');
});

test('should render a big button', () => {
render(<Button id="button" size="big"></Button>);
expect(screen.getByTestId('button')).toHaveClass('usa-button--big');
});

test('should render a button with custom className', () => {
render(<Button id="button" className="usa-custom"></Button>);
expect(screen.getByTestId('button')).toHaveClass('usa-custom');
Expand Down
8 changes: 6 additions & 2 deletions packages/comet-uswds/src/components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ export interface ButtonProps {
| 'base'
| 'outline'
| 'outline-inverse'
| 'big'
| 'unstyled';
/**
* The size of the button
*/
size?: 'default' | 'big';
/**
* A custom class to apply to the component
*/
Expand All @@ -44,6 +47,7 @@ export const Button = ({
id,
type = 'button',
variant = 'default',
size = 'default',
className,
children,
...props
Expand All @@ -57,8 +61,8 @@ export const Button = ({
'usa-button--base': variant === 'base',
'usa-button--outline': variant === 'outline',
'usa-button--outline usa-button--inverse': variant === 'outline-inverse',
'usa-button--big': variant === 'big',
'usa-button--unstyled': variant === 'unstyled',
'usa-button--big': size === 'big',
},
className,
);
Expand Down

0 comments on commit 20d816d

Please sign in to comment.