Skip to content

Commit

Permalink
added story
Browse files Browse the repository at this point in the history
  • Loading branch information
werdnanoslen authored and lpsinger committed Mar 6, 2024
1 parent 2c03a44 commit cb2e35f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/forms/DatePicker/DatePicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,23 @@ import { FormGroup } from '../FormGroup/FormGroup'
import { Label } from '../Label/Label'
import { TextInput } from '../TextInput/TextInput'
import { ValidationStatus } from '../../../types/validationStatus'
import {
DEFAULT_EXTERNAL_DATE_FORMAT,
DateFormat,
INTERNAL_DATE_FORMAT,
} from './constants'

export default {
title: 'Components/Date picker',
component: DatePicker,
argTypes: {
dateFormat: {
control: 'radio',
options: [
DEFAULT_EXTERNAL_DATE_FORMAT as DateFormat,
INTERNAL_DATE_FORMAT as DateFormat,
],
},
onSubmit: { action: 'submitted' },
disabled: { control: { type: 'boolean' } },
validationStatus: {
Expand Down Expand Up @@ -50,6 +62,7 @@ We may find that we want to expose props for custom event handlers or even a ref
}

type StorybookArguments = {
dateFormat: DateFormat
onSubmit: React.FormEventHandler<HTMLFormElement>
disabled?: boolean
validationStatus?: ValidationStatus
Expand All @@ -66,7 +79,7 @@ export const CompleteDatePicker = {
Appointment date
</Label>
<div className="usa-hint" id="appointment-date-hint">
mm/dd/yyyy
{argTypes.dateFormat ?? DEFAULT_EXTERNAL_DATE_FORMAT}
</div>
<DatePicker
id="appointment-date"
Expand All @@ -75,6 +88,7 @@ export const CompleteDatePicker = {
aria-labelledby="appointment-date-label"
disabled={argTypes.disabled}
validationStatus={argTypes.validationStatus}
dateFormat={argTypes.dateFormat}
/>
</FormGroup>
<Label htmlFor="otherInput">Another unrelated input</Label>
Expand Down

0 comments on commit cb2e35f

Please sign in to comment.