-
Notifications
You must be signed in to change notification settings - Fork 839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Storybook] Add stories for more components (letters R-S) - Part 4 #7733
Changes from 7 commits
ee2c766
35ce0c5
f305764
165c070
32fee37
3b3a81e
460b59e
6b8eb75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { hideStorybookControls } from '../../../.storybook/utils'; | ||
import { EuiStep, EuiStepProps } from './step'; | ||
|
||
const meta: Meta<EuiStepProps> = { | ||
title: 'Navigation/EuiSteps/EuiSteps/EuiStep', | ||
component: EuiStep, | ||
args: { | ||
headingElement: 'p', | ||
titleSize: 's', | ||
step: 1, | ||
}, | ||
}; | ||
hideStorybookControls(meta, ['aria-label']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiStepProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
title: 'Step 1', | ||
children: 'lorem ipsum', | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { | ||
enableFunctionToggleControls, | ||
hideStorybookControls, | ||
} from '../../../.storybook/utils'; | ||
import { EuiStepHorizontal, EuiStepHorizontalProps } from './step_horizontal'; | ||
|
||
const meta: Meta<EuiStepHorizontalProps> = { | ||
title: 'Navigation/EuiSteps/EuiStepsHorizontal/EuiStepHorizontal', | ||
component: EuiStepHorizontal, | ||
args: { | ||
size: 'm', | ||
step: 1, | ||
status: 'incomplete', | ||
// set up for easier testing/QA | ||
disabled: false, | ||
}, | ||
}; | ||
hideStorybookControls(meta, ['aria-label']); | ||
enableFunctionToggleControls(meta, ['onClick']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiStepHorizontalProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
title: 'Step 1', | ||
children: 'lorem ipsum', | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { hideStorybookControls } from '../../../.storybook/utils'; | ||
import { EuiStepNumber, EuiStepNumberProps } from './step_number'; | ||
|
||
const meta: Meta<EuiStepNumberProps> = { | ||
title: 'Navigation/EuiSteps/Subcomponents/EuiStepNumber', | ||
component: EuiStepNumber, | ||
args: { | ||
titleSize: 's', | ||
}, | ||
}; | ||
hideStorybookControls(meta, ['aria-label']); | ||
cee-chen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export default meta; | ||
type Story = StoryObj<EuiStepNumberProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
number: 1, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { moveStorybookControlsToCategory } from '../../../.storybook/utils'; | ||
import { EuiSteps, EuiStepsProps } from './steps'; | ||
|
||
const meta: Meta<EuiStepsProps> = { | ||
title: 'Navigation/EuiSteps/EuiSteps', | ||
cee-chen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
component: EuiSteps, | ||
args: { | ||
firstStepNumber: 1, | ||
headingElement: 'p', | ||
titleSize: 's', | ||
}, | ||
}; | ||
moveStorybookControlsToCategory( | ||
meta, | ||
['headingElement', 'titleSize'], | ||
'EuiStep props' | ||
); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiStepsProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
steps: [ | ||
{ | ||
title: 'Step 1', | ||
children: 'lorem ipsum', | ||
}, | ||
{ | ||
title: 'Step 2', | ||
children: 'lorem ipsum', | ||
status: 'current', | ||
}, | ||
{ | ||
title: 'Step 3', | ||
children: 'lorem ipsum', | ||
status: 'complete', | ||
}, | ||
{ | ||
title: 'Step 4', | ||
children: 'lorem ipsum', | ||
status: 'incomplete', | ||
}, | ||
{ | ||
title: 'Step 5', | ||
children: 'lorem ipsum', | ||
status: 'warning', | ||
}, | ||
{ | ||
title: 'Step 6', | ||
children: 'lorem ipsum', | ||
status: 'danger', | ||
}, | ||
{ | ||
title: 'Step 7', | ||
children: 'lorem ipsum', | ||
status: 'loading', | ||
}, | ||
{ | ||
title: 'Step 8', | ||
children: 'lorem ipsum', | ||
status: 'disabled', | ||
}, | ||
], | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
import { moveStorybookControlsToCategory } from '../../../.storybook/utils'; | ||
import { | ||
EuiStepsHorizontal, | ||
EuiStepsHorizontalProps, | ||
} from './steps_horizontal'; | ||
|
||
const meta: Meta<EuiStepsHorizontalProps> = { | ||
title: 'Navigation/EuiSteps/EuiStepsHorizontal', | ||
component: EuiStepsHorizontal, | ||
args: { | ||
size: 'm', | ||
}, | ||
}; | ||
moveStorybookControlsToCategory(meta, ['size'], 'EuiStepHorizontal props'); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiStepsHorizontalProps>; | ||
|
||
const onClick = action('onClick'); | ||
|
||
export const Playground: Story = { | ||
args: { | ||
steps: [ | ||
{ | ||
title: 'Step 1', | ||
onClick, | ||
}, | ||
{ | ||
title: 'Step 2', | ||
status: 'current', | ||
onClick, | ||
}, | ||
{ | ||
title: 'Step 3', | ||
status: 'complete', | ||
onClick, | ||
}, | ||
{ | ||
title: 'Step 4', | ||
status: 'incomplete', | ||
onClick, | ||
}, | ||
{ | ||
title: 'Step 5', | ||
status: 'warning', | ||
onClick, | ||
}, | ||
{ | ||
title: 'Step 6', | ||
status: 'danger', | ||
onClick, | ||
}, | ||
{ | ||
title: 'Step 7', | ||
status: 'loading', | ||
onClick, | ||
}, | ||
{ | ||
title: 'Step 8', | ||
status: 'disabled', | ||
onClick, | ||
}, | ||
], | ||
}, | ||
}; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [just me thinking out loud] I sometimes wonder how much value consumers get from us exporting subcomponents like this, vs just the higher level components 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can have value to understand what's available, how it works etc. Or even to maybe reuse some components in other contexts even if unexpected? 🤔 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { EuiSubSteps, EuiSubStepsProps } from './sub_steps'; | ||
|
||
const meta: Meta<EuiSubStepsProps> = { | ||
title: 'Navigation/EuiSteps/Subcomponents/EuiSubSteps', | ||
component: EuiSubSteps, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiSubStepsProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: 'lorem ipsum dolor sit', | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, if I remember correctly, we had a discussion some time ago about nesting conventions and agreed that we nest subcomponents under the components based on component name and that we wouldn't add other folders as that might be confusing? (conversation)
So the idea would be that
EuiStepNumber
is a subcomponent ofEuiSteps
(or evenEuiStep
) so it's nested under those.Next to other components the naming
Subcomponents
now would mean there is a component calledSubcomponents
if we go by how we organized components so far 😅