-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Doc Blocks: Add support for of
prop to Primary
block
#23849
Changes from 3 commits
79c2201
f720962
92c7a3f
d2c6faa
9da4588
fb9f274
d19c4c6
19fb867
73a3c31
bc01165
b36c473
9bff994
0daba67
ebfd6b1
25ebc72
739278c
2adab92
6313c9e
5b2f817
e3d4e1d
9198f30
57ac6ba
393b0db
d3cabc6
132f0a8
066258f
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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Primary } from './Primary'; | ||
import * as DefaultButtonStories from '../examples/Button.stories'; | ||
import * as StoriesParametersStories from '../examples/StoriesParameters.stories'; | ||
|
||
const meta = { | ||
const meta: Meta<typeof Primary> = { | ||
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. Curious why you changed from the 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. Hi, thanks for reviewing my code! I changed it based off other PRs and off of Description.stories.tsx. But this is a good question, and after some research, I'll change it back to satisfies since it's just better for validation and type safety. |
||
component: Primary, | ||
parameters: { | ||
// workaround for https://github.com/storybookjs/storybook/issues/20505 | ||
docs: { source: { type: 'code' } }, | ||
docsStyles: true, | ||
}, | ||
} satisfies Meta<typeof Primary>; | ||
|
||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
@@ -22,3 +25,55 @@ export const WithoutToolbar: Story = { | |
relativeCsfPaths: ['../examples/StoriesParameters.stories'], | ||
}, | ||
}; | ||
|
||
export const DefaultWithName: Story = { | ||
name: 'Name', | ||
args: { | ||
name: 'Primary', | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/Button.stories'], | ||
}, | ||
}; | ||
|
||
export const WithoutToolbarWithName: Story = { | ||
name: 'Name Without Toolbar', | ||
args: { | ||
name: 'Without Toolbar', | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/StoriesParameters.stories'], | ||
}, | ||
}; | ||
|
||
export const DefaultWithOf: Story = { | ||
name: 'Of', | ||
args: { | ||
of: DefaultButtonStories, | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'] }, | ||
}; | ||
|
||
export const WithoutToolbarWithOf: Story = { | ||
name: 'Of Without Toolbar', | ||
args: { | ||
of: StoriesParametersStories, | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/StoriesParameters.stories'] }, | ||
}; | ||
|
||
export const DefaultOfStringMetaAttached: Story = { | ||
name: 'Of Attached "meta"', | ||
args: { | ||
of: 'meta', | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'] }, | ||
}; | ||
|
||
export const WithoutToolbarOfStringMetaAttached: Story = { | ||
name: 'Of Attached "meta" Without Toolbar', | ||
args: { | ||
of: 'meta', | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/StoriesParameters.stories'] }, | ||
}; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -29,6 +29,12 @@ import { Primary } from '@storybook/blocks'; | |||||
|
||||||
`Primary` is configured with the following props: | ||||||
|
||||||
### `of` | ||||||
|
||||||
Type: CSF file exports | ||||||
|
||||||
Specifies the primary (first) story to be rendered. | ||||||
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. Can we state something similar to Meta's
Suggested change
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. Yeah sure thing, I'll push a commit with the other fix today. |
||||||
|
||||||
### `name` | ||||||
|
||||||
(⛔️ **Deprecated**) | ||||||
|
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.
These migration guides are between specific versions, adding this note here communicates that this was introduced in 7.0, while it's probably being introduced in 7.6.
I suggest you create a new top section below the Table Of Content called "From version 7.5.0 to 7.6.0", that includes this content. Given that this will move it "out" of the doc block section, you probably need to add a bit more context and link to this doc block section.
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.
Ok sounds good, I'll push a commit along with the other one updating the docs.