Skip to content

Commit 20d816d

Browse files
authored
Merge pull request #248 from MetroStar/big-button-updates
Big Button Updates
2 parents e2e1260 + 40f2189 commit 20d816d

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/comet-uswds/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metrostar/comet-uswds",
3-
"version": "3.0.1",
3+
"version": "3.1.0",
44
"description": "React with TypeScript Component Library based on USWDS 3.0.",
55
"license": "Apache-2.0",
66
"main": "./dist/cjs/index.js",

packages/comet-uswds/src/components/button/button.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const meta: Meta<typeof Button> = {
1010
id: { required: true },
1111
type: { control: 'select', required: true },
1212
variant: { control: 'select' },
13+
size: { control: 'select' },
1314
disabled: { control: 'boolean' },
1415
},
1516
};
@@ -22,6 +23,7 @@ Default.args = {
2223
id: 'button-1',
2324
type: 'button',
2425
variant: 'default',
26+
size: 'default',
2527
className: '',
2628
disabled: false,
2729
};

packages/comet-uswds/src/components/button/button.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ describe('Button', () => {
4343
expect(screen.getByTestId('button')).toHaveClass('usa-button--inverse');
4444
});
4545

46-
test('should render a big button', () => {
47-
render(<Button id="button" variant="big"></Button>);
48-
expect(screen.getByTestId('button')).toHaveClass('usa-button--big');
49-
});
50-
5146
test('should render a unstyled button', () => {
5247
render(<Button id="button" variant="unstyled"></Button>);
5348
expect(screen.getByTestId('button')).toHaveClass('usa-button--unstyled');
5449
});
5550

51+
test('should render a big button', () => {
52+
render(<Button id="button" size="big"></Button>);
53+
expect(screen.getByTestId('button')).toHaveClass('usa-button--big');
54+
});
55+
5656
test('should render a button with custom className', () => {
5757
render(<Button id="button" className="usa-custom"></Button>);
5858
expect(screen.getByTestId('button')).toHaveClass('usa-custom');

packages/comet-uswds/src/components/button/button.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ export interface ButtonProps {
2121
| 'base'
2222
| 'outline'
2323
| 'outline-inverse'
24-
| 'big'
2524
| 'unstyled';
25+
/**
26+
* The size of the button
27+
*/
28+
size?: 'default' | 'big';
2629
/**
2730
* A custom class to apply to the component
2831
*/
@@ -44,6 +47,7 @@ export const Button = ({
4447
id,
4548
type = 'button',
4649
variant = 'default',
50+
size = 'default',
4751
className,
4852
children,
4953
...props
@@ -57,8 +61,8 @@ export const Button = ({
5761
'usa-button--base': variant === 'base',
5862
'usa-button--outline': variant === 'outline',
5963
'usa-button--outline usa-button--inverse': variant === 'outline-inverse',
60-
'usa-button--big': variant === 'big',
6164
'usa-button--unstyled': variant === 'unstyled',
65+
'usa-button--big': size === 'big',
6266
},
6367
className,
6468
);

0 commit comments

Comments
 (0)