-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added button, checkbox, radiobutton components. Still need to add fun…
…ctionality to checkbox and radio button.
- Loading branch information
Showing
6 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
secondary, | ||
textOnly, | ||
uswds | ||
} }) { | ||
|
||
return ( | ||
<button key={id} type="button" | ||
className={classNames('usa-button', { | ||
'usa-button--outline': secondary, | ||
'usa-button--unstyled': textOnly, | ||
})} | ||
> | ||
{label} | ||
</button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
uswds | ||
} }) { | ||
|
||
return ( | ||
|
||
<div className="usa-checkbox"> | ||
<input | ||
key={id} | ||
type="checkbox" | ||
className={classNames('usa-checkbox__input', )} | ||
/> | ||
<label | ||
className="usa-checkbox__label" | ||
> | ||
{label} | ||
</label> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import classNames from 'classnames'; | ||
import React from 'react'; | ||
|
||
export default function Radio({ props: { | ||
id, | ||
label, | ||
secondary, | ||
uswds | ||
} }) { | ||
|
||
return ( | ||
<div className="usa-radio"> | ||
<input | ||
key={id} | ||
className="usa-radio__input" | ||
type="radio" | ||
/> | ||
<label | ||
className="usa-radio__label" | ||
> | ||
{label} | ||
</label> | ||
</div> | ||
) | ||
} |