-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
creates separate InputOptionContent.stories
- Loading branch information
1 parent
82055b9
commit 34740be
Showing
4 changed files
with
152 additions
and
61 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
139 changes: 139 additions & 0 deletions
139
packages/input-option/src/InputOptionContent/InputOptionContent.stories.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,139 @@ | ||
/* eslint-disable react/jsx-key */ | ||
import React from 'react'; | ||
import { | ||
InstanceDecorator, | ||
storybookArgTypes, | ||
storybookExcludedControlParams, | ||
StoryMetaType, | ||
} from '@lg-tools/storybook-utils'; | ||
import { StoryObj } from '@storybook/react'; | ||
|
||
import Icon, { glyphs } from '@leafygreen-ui/icon'; | ||
|
||
import { InputOption } from '../InputOption'; | ||
|
||
import { InputOptionContent } from '.'; | ||
|
||
const _withInputOptionDecorator: InstanceDecorator< | ||
typeof InputOption & typeof InputOptionContent | ||
> = (Instance, ctx) => { | ||
const { | ||
args: { darkMode, highlighted, checked, disabled }, | ||
} = ctx || { args: {} }; | ||
return ( | ||
<InputOption | ||
darkMode={darkMode} | ||
highlighted={highlighted} | ||
checked={checked} | ||
disabled={disabled} | ||
> | ||
<Instance /> | ||
</InputOption> | ||
); | ||
}; | ||
|
||
export default { | ||
title: 'Components/InputOption/Content', | ||
component: InputOptionContent, | ||
parameters: { | ||
default: 'Basic', | ||
controls: { | ||
exclude: [...storybookExcludedControlParams], | ||
}, | ||
generate: { | ||
storyNames: ['Basic', 'Highlighted', 'Checked', 'Disabled'], | ||
combineArgs: { | ||
darkMode: [false, true], | ||
description: [undefined, 'Description'], | ||
preserveIconSpace: [false, true], | ||
leftGlyph: [undefined, <Icon glyph="Cloud" />], | ||
rightGlyph: [undefined, <Icon glyph="ChevronDown" />], | ||
}, | ||
excludeCombinations: [ | ||
{ | ||
leftGlyph: undefined, | ||
rightGlyph: <Icon glyph="ChevronDown" />, | ||
}, | ||
{ | ||
preserveIconSpace: false, | ||
leftGlyph: <Icon glyph="Cloud" />, | ||
}, | ||
], | ||
decorator: _withInputOptionDecorator, | ||
}, | ||
}, | ||
args: { | ||
children: 'Some text', | ||
showWedge: true, | ||
}, | ||
argTypes: { | ||
disabled: { | ||
control: 'boolean', | ||
}, | ||
highlighted: { | ||
control: 'boolean', | ||
}, | ||
checked: { | ||
control: 'boolean', | ||
}, | ||
showWedge: { | ||
control: 'boolean', | ||
}, | ||
leftGlyph: { | ||
options: Object.keys(glyphs), | ||
control: { type: 'select' }, | ||
}, | ||
rightGlyph: { | ||
options: Object.keys(glyphs), | ||
control: { type: 'select' }, | ||
}, | ||
description: { | ||
control: { type: 'text' }, | ||
}, | ||
as: storybookArgTypes.as, | ||
}, | ||
} satisfies StoryMetaType<typeof InputOptionContent>; | ||
|
||
export const Basic = { | ||
render: () => <></>, | ||
} satisfies StoryObj<typeof InputOptionContent>; | ||
|
||
export const Highlighted = { | ||
render: () => <></>, | ||
parameters: { | ||
generate: { | ||
args: { | ||
description: 'Description', | ||
rightGlyph: <Icon glyph="ChevronDown" />, | ||
highlighted: true, | ||
}, | ||
}, | ||
}, | ||
} satisfies StoryObj<typeof InputOptionContent>; | ||
|
||
export const Checked = { | ||
render: () => <></>, | ||
parameters: { | ||
generate: { | ||
args: { | ||
description: 'Description', | ||
rightGlyph: <Icon glyph="ChevronDown" />, | ||
checked: true, | ||
}, | ||
combineArgs: { | ||
highlighted: [false, true], | ||
}, | ||
}, | ||
}, | ||
} satisfies StoryObj<typeof InputOptionContent>; | ||
|
||
export const Disabled = { | ||
render: () => <></>, | ||
parameters: { | ||
generate: { | ||
args: { | ||
disabled: true, | ||
}, | ||
}, | ||
}, | ||
} satisfies StoryObj<typeof InputOptionContent>; |
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