Skip to content

Commit

Permalink
Added button, checkbox, radiobutton components. Still need to add fun…
Browse files Browse the repository at this point in the history
…ctionality to checkbox and radio button.
  • Loading branch information
jasnakai committed Mar 27, 2024
1 parent afd950d commit 85ef98e
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 0 deletions.
64 changes: 64 additions & 0 deletions packages/design/src/Components/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import Button from './Button';

export default {
component: Button,
title: 'Components/Button',
tags: ['autodocs'],
};

export const Primary = {
args: {
props: {
id: '1',
label: 'Primary'
},
},
};

export const Secondary = {
args: {
props: {
id: '2',
label: 'Secondary',
secondary: true
},
},
};

export const Continue = {
args: {
props: {
id: '5',
label: 'Continue >>'
},
},
};

export const SaveContinue = {
args: {
props: {
id: '6',
label: 'Save & Continue >>'
},
},
};

export const Back = {
args: {
props: {
id: '7',
label: '<< Back',
textOnly: true
},
},
};

export const Cancel = {
args: {
props: {
id: '8',
label: 'Cancel',
textOnly: true
},
},
};
23 changes: 23 additions & 0 deletions packages/design/src/Components/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import classNames from 'classnames';
import React from 'react';

export default function Button({ props: {
id,
label,
disabled,

Check failure on line 7 in packages/design/src/Components/Button.tsx

View workflow job for this annotation

GitHub Actions / run-tests (ubuntu-latest, x86_64)

'disabled' is defined but never used
secondary,
textOnly,
uswds

Check failure on line 10 in packages/design/src/Components/Button.tsx

View workflow job for this annotation

GitHub Actions / run-tests (ubuntu-latest, x86_64)

'uswds' is defined but never used
} }) {

return (
<button key={id} type="button"
className={classNames('usa-button', {
'usa-button--outline': secondary,
'usa-button--unstyled': textOnly,
})}
>
{label}
</button>
)
}
25 changes: 25 additions & 0 deletions packages/design/src/Components/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Checkbox from './Checkbox';

export default {
component: Checkbox,
title: 'Components/Checkbox',
tags: ['autodocs'],
};

export const Primary = {
args: {
props: {
id: '1',
label: 'Primary'
},
},
};

export const Secondary = {
args: {
props: {
id: '2',
label: 'Secondary'
},
},
};
26 changes: 26 additions & 0 deletions packages/design/src/Components/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import classNames from 'classnames';
import React from 'react';

export default function Checkbox({ props: {
id,
label,
secondary,

Check failure on line 7 in packages/design/src/Components/Checkbox.tsx

View workflow job for this annotation

GitHub Actions / run-tests (ubuntu-latest, x86_64)

'secondary' is defined but never used
uswds

Check failure on line 8 in packages/design/src/Components/Checkbox.tsx

View workflow job for this annotation

GitHub Actions / run-tests (ubuntu-latest, x86_64)

'uswds' is defined but never used
} }) {

return (

<div className="usa-checkbox">
<input
key={id}
type="checkbox"
className={classNames('usa-checkbox__input', )}
/>
<label
className="usa-checkbox__label"
>
{label}
</label>
</div>
)
}
25 changes: 25 additions & 0 deletions packages/design/src/Components/Radio.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Radio from './Radio';

export default {
component: Radio,
title: 'Components/Radio',
tags: ['autodocs'],
};

export const Primary = {
args: {
props: {
id: '1',
label: 'Primary'
},
},
};

export const Secondary = {
args: {
props: {
id: '2',
label: 'Secondary'
},
},
};
25 changes: 25 additions & 0 deletions packages/design/src/Components/Radio.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import classNames from 'classnames';

Check failure on line 1 in packages/design/src/Components/Radio.tsx

View workflow job for this annotation

GitHub Actions / run-tests (ubuntu-latest, x86_64)

'classNames' is defined but never used
import React from 'react';

export default function Radio({ props: {
id,
label,
secondary,

Check failure on line 7 in packages/design/src/Components/Radio.tsx

View workflow job for this annotation

GitHub Actions / run-tests (ubuntu-latest, x86_64)

'secondary' is defined but never used
uswds

Check failure on line 8 in packages/design/src/Components/Radio.tsx

View workflow job for this annotation

GitHub Actions / run-tests (ubuntu-latest, x86_64)

'uswds' is defined but never used
} }) {

return (
<div className="usa-radio">
<input
key={id}
className="usa-radio__input"
type="radio"
/>
<label
className="usa-radio__label"
>
{label}
</label>
</div>
)
}

0 comments on commit 85ef98e

Please sign in to comment.