Skip to content

Commit

Permalink
Added Checkbox and Radio components. Still needs functioanliaty.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnakai committed Mar 26, 2024
1 parent 6b337b9 commit 040d2a6
Show file tree
Hide file tree
Showing 22 changed files with 79,549 additions and 80 deletions.
6 changes: 6 additions & 0 deletions packages/design/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ main {
&:hover {
background-color: #783cb9;
}

&.usa-button--outline,
&.usa-button--unstyled {
background: transparent;
text-decoration: underline;
}
}

.usa-header,
Expand Down
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>
)
}
Loading

0 comments on commit 040d2a6

Please sign in to comment.