Skip to content

Commit cb2e35f

Browse files
werdnanoslenlpsinger
authored andcommitted
added story
1 parent 2c03a44 commit cb2e35f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/components/forms/DatePicker/DatePicker.stories.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,23 @@ import { FormGroup } from '../FormGroup/FormGroup'
77
import { Label } from '../Label/Label'
88
import { TextInput } from '../TextInput/TextInput'
99
import { ValidationStatus } from '../../../types/validationStatus'
10+
import {
11+
DEFAULT_EXTERNAL_DATE_FORMAT,
12+
DateFormat,
13+
INTERNAL_DATE_FORMAT,
14+
} from './constants'
1015

1116
export default {
1217
title: 'Components/Date picker',
1318
component: DatePicker,
1419
argTypes: {
20+
dateFormat: {
21+
control: 'radio',
22+
options: [
23+
DEFAULT_EXTERNAL_DATE_FORMAT as DateFormat,
24+
INTERNAL_DATE_FORMAT as DateFormat,
25+
],
26+
},
1527
onSubmit: { action: 'submitted' },
1628
disabled: { control: { type: 'boolean' } },
1729
validationStatus: {
@@ -50,6 +62,7 @@ We may find that we want to expose props for custom event handlers or even a ref
5062
}
5163

5264
type StorybookArguments = {
65+
dateFormat: DateFormat
5366
onSubmit: React.FormEventHandler<HTMLFormElement>
5467
disabled?: boolean
5568
validationStatus?: ValidationStatus
@@ -66,7 +79,7 @@ export const CompleteDatePicker = {
6679
Appointment date
6780
</Label>
6881
<div className="usa-hint" id="appointment-date-hint">
69-
mm/dd/yyyy
82+
{argTypes.dateFormat ?? DEFAULT_EXTERNAL_DATE_FORMAT}
7083
</div>
7184
<DatePicker
7285
id="appointment-date"
@@ -75,6 +88,7 @@ export const CompleteDatePicker = {
7588
aria-labelledby="appointment-date-label"
7689
disabled={argTypes.disabled}
7790
validationStatus={argTypes.validationStatus}
91+
dateFormat={argTypes.dateFormat}
7892
/>
7993
</FormGroup>
8094
<Label htmlFor="otherInput">Another unrelated input</Label>

0 commit comments

Comments
 (0)