-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5d03c9
commit 3cf2c8d
Showing
3 changed files
with
119 additions
and
40 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
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
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,99 @@ | ||
/* eslint-disable react/jsx-handler-names */ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import Checkbox from './Checkbox'; | ||
import { CheckboxWrapper } from './Checkbox.utils'; | ||
|
||
/** | ||
Use checkboxes when the user can select more than one option from a list. Make clear with helper text that this is the case. Use [radio buttons](https://cfpb.github.io/design-system/components/radio-buttons) when the user can choose only one option from a list. | ||
Source: https://cfpb.github.io/design-system/components/checkboxes | ||
*/ | ||
const meta: Meta<typeof Checkbox> = { | ||
title: 'Components (Verified)/Checkboxes/Large target area', | ||
component: Checkbox, | ||
argTypes: { | ||
disabled: { control: 'boolean' }, | ||
isLarge: { control: 'boolean' } | ||
} | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Enabled: Story = { | ||
render: _arguments => CheckboxWrapper(_arguments), | ||
name: 'Enabled', | ||
args: { | ||
id: 'Enabled', | ||
label: 'Enabled', | ||
isLarge: true | ||
} | ||
}; | ||
|
||
export const Hover: Story = { | ||
render: _arguments => CheckboxWrapper(_arguments), | ||
name: 'Hover', | ||
args: { | ||
id: 'hover', | ||
label: 'Hover', | ||
inputClassName: 'hover', | ||
isLarge: true | ||
} | ||
}; | ||
|
||
export const Focus: Story = { | ||
render: _arguments => CheckboxWrapper(_arguments), | ||
name: 'Focus', | ||
args: { | ||
id: 'focus', | ||
label: 'Focus', | ||
inputClassName: 'focus', | ||
isLarge: true | ||
} | ||
}; | ||
|
||
export const Selected: Story = { | ||
render: _arguments => CheckboxWrapper(_arguments), | ||
name: 'Selected', | ||
args: { | ||
id: 'selected', | ||
label: 'Selected', | ||
isLarge: true, | ||
checked: true | ||
} | ||
}; | ||
|
||
export const Disabled: Story = { | ||
render: _arguments => CheckboxWrapper(_arguments), | ||
name: 'Disabled', | ||
args: { | ||
id: 'disabled', | ||
label: 'Disabled', | ||
isLarge: true, | ||
disabled: true | ||
} | ||
}; | ||
|
||
export const DisabledSelected: Story = { | ||
render: _arguments => CheckboxWrapper(_arguments), | ||
name: 'Disabled/Selected', | ||
args: { | ||
id: 'disabled/selected', | ||
label: 'Disabled/Selected', | ||
isLarge: true, | ||
disabled: true, | ||
checked: true | ||
} | ||
}; | ||
|
||
export const WithHelperText: Story = { | ||
render: _arguments => CheckboxWrapper(_arguments), | ||
name: 'With helper text', | ||
args: { | ||
id: 'withHelperText', | ||
label: 'Label', | ||
isLarge: true, | ||
helperText: 'This is optional helper text' | ||
} | ||
}; |