-
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.
Docs(web-react): Add Radio demo #DS-905
- Radio demo in web-react is now same as demo in web and web-twig
- Loading branch information
1 parent
4e1b5eb
commit 7d23e21
Showing
10 changed files
with
93 additions
and
93 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
packages/web-react/src/components/Radio/demo/RadioDefault.tsx
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,12 @@ | ||
import React from 'react'; | ||
import Radio from '../Radio'; | ||
|
||
const RadioDefault = () => ( | ||
<> | ||
<Radio id="radioDefault" label="Radio Label" name="radioDefault" /> | ||
|
||
<Radio id="radioDefaultChecked" isChecked label="Radio Label" name="radioDefault" /> | ||
</> | ||
); | ||
|
||
export default RadioDefault; |
22 changes: 14 additions & 8 deletions
22
packages/web-react/src/components/Radio/demo/RadioDisabled.tsx
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 |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import React from 'react'; | ||
import Radio from '../Radio'; | ||
|
||
// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const Story = (props: unknown) => ( | ||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '1.5rem 1rem' }}> | ||
<Radio id="radio" label="Radio disabled" name="example" isDisabled /> | ||
<Radio id="radio" label="Radio disabled checked" name="example" isDisabled isChecked /> | ||
</div> | ||
const RadioDisabled = () => ( | ||
<> | ||
<Radio id="radioDisabled" isDisabled label="Radio Label" name="radioDisabled" /> | ||
|
||
<Radio | ||
helperText="Helper text" | ||
id="radioDisabledHelperText" | ||
isChecked | ||
isDisabled | ||
label="Radio Label" | ||
name="radioDisabledHelperText" | ||
/> | ||
</> | ||
); | ||
|
||
export default Story; | ||
export default RadioDisabled; |
17 changes: 4 additions & 13 deletions
17
packages/web-react/src/components/Radio/demo/RadioHelperText.tsx
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 |
---|---|---|
@@ -1,17 +1,8 @@ | ||
import React from 'react'; | ||
import Radio from '../Radio'; | ||
import { SpiritRadioProps } from '../../../types'; | ||
|
||
const Story = (args: SpiritRadioProps) => <Radio {...args} />; | ||
const RadioHelperText = () => ( | ||
<Radio helperText="Helper text" id="radioHelperText" label="Radio Label" name="radioHelperText" /> | ||
); | ||
|
||
Story.args = { | ||
id: 'example', | ||
isChecked: true, | ||
isDisabled: false, | ||
isLabelHidden: false, | ||
label: 'Label', | ||
name: 'example', | ||
helperText: 'Helper text', | ||
}; | ||
|
||
export default Story; | ||
export default RadioHelperText; |
8 changes: 8 additions & 0 deletions
8
packages/web-react/src/components/Radio/demo/RadioHiddenLabel.tsx
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,8 @@ | ||
import React from 'react'; | ||
import Radio from '../Radio'; | ||
|
||
const RadioHiddenLabel = () => ( | ||
<Radio id="radioHiddenLabel" label="Radio Label" name="radioHiddenLabel" isLabelHidden /> | ||
); | ||
|
||
export default RadioHiddenLabel; |
29 changes: 21 additions & 8 deletions
29
packages/web-react/src/components/Radio/demo/RadioItem.tsx
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 |
---|---|---|
@@ -1,13 +1,26 @@ | ||
import React from 'react'; | ||
import Radio from '../Radio'; | ||
|
||
// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244 | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const Story = (props: unknown) => ( | ||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '1.5rem 1rem' }}> | ||
<Radio id="radio" label="Radio Item" name="example" isItem /> | ||
<Radio id="radio" label="Radio Item checked" name="example" isItem isChecked /> | ||
</div> | ||
const RadioItem = () => ( | ||
<> | ||
<Radio id="radioItemDefault" isItem label="Radio Label" name="item" /> | ||
|
||
<Radio id="radioItemDefaultChecked" isChecked isItem label="Radio Label" name="item" /> | ||
|
||
<Radio helperText="Helper text" id="radioItemHelperText" isItem label="Radio Label" name="item" /> | ||
|
||
<Radio id="radioItemDisabled" isDisabled isItem label="Radio Label" name="itemDisabled" /> | ||
|
||
<Radio | ||
helperText="Helper text" | ||
id="radioItemDisabledHelperText" | ||
isDisabled | ||
isChecked | ||
isItem | ||
label="Radio Label" | ||
name="itemDisabled" | ||
/> | ||
</> | ||
); | ||
|
||
export default Story; | ||
export default RadioItem; |
33 changes: 0 additions & 33 deletions
33
packages/web-react/src/components/Radio/demo/RadioList.tsx
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
packages/web-react/src/components/Radio/demo/RadioValidation.tsx
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 React from 'react'; | ||
import Radio from '../Radio'; | ||
|
||
const RadioValidation = () => ( | ||
<> | ||
<Radio id="radioSuccess" label="Radio Label" name="validation" validationState="success" /> | ||
|
||
<Radio id="radioWarning" label="Radio Label" name="validation" validationState="warning" /> | ||
|
||
<Radio id="radioDanger" isChecked label="Radio Label" name="validation" validationState="danger" /> | ||
|
||
<Radio | ||
helperText="Helper text" | ||
id="radioWarningHelperText" | ||
isChecked | ||
label="Radio Label" | ||
name="validation" | ||
validationState="warning" | ||
/> | ||
</> | ||
); | ||
|
||
export default RadioValidation; |
12 changes: 0 additions & 12 deletions
12
packages/web-react/src/components/Radio/demo/RadioValidationState.tsx
This file was deleted.
Oops, something went wrong.
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