-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20563 from storybookjs/block-description-improvem…
…ents Blocks: new Description API, introduce useOf
- Loading branch information
Showing
12 changed files
with
382 additions
and
35 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
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,23 +1,132 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Description } from './Description'; | ||
import { Button } from '../examples/Button'; | ||
import { Button as ButtonComponent } from '../examples/Button'; | ||
import * as DefaultButtonStories from '../examples/Button.stories'; | ||
import * as ButtonStoriesWithMetaDescriptionAsParameter from '../examples/ButtonWithMetaDescriptionAsParameter.stories'; | ||
import * as ButtonStoriesWithMetaDescriptionAsComment from '../examples/ButtonWithMetaDescriptionAsComment.stories'; | ||
import * as ButtonStoriesWithMetaDescriptionAsBoth from '../examples/ButtonWithMetaDescriptionAsBoth.stories'; | ||
|
||
const meta: Meta<typeof Description> = { | ||
component: Description, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/Button.stories'], | ||
controls: { | ||
include: [], | ||
hideNoControlsWarning: true, | ||
}, | ||
// workaround for https://github.com/storybookjs/storybook/issues/20505 | ||
docs: { source: { type: 'code' } }, | ||
attached: false, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const ButtonComponent: Story = { | ||
export const OfComponentAsComponentComment: Story = { | ||
args: { | ||
of: Button, | ||
of: ButtonComponent, | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'] }, | ||
}; | ||
export const OfCSFFileAsComponentComment: Story = { | ||
args: { | ||
of: DefaultButtonStories, | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'] }, | ||
}; | ||
export const OfCSFFileAsMetaComment: Story = { | ||
args: { | ||
of: ButtonStoriesWithMetaDescriptionAsComment, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaDescriptionAsComment.stories'], | ||
}, | ||
}; | ||
export const OfCSFFileAsParameter: Story = { | ||
args: { | ||
of: ButtonStoriesWithMetaDescriptionAsParameter, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaDescriptionAsParameter.stories'], | ||
}, | ||
}; | ||
export const OfCSFFileAsMetaCommentAndParameter: Story = { | ||
args: { | ||
of: ButtonStoriesWithMetaDescriptionAsBoth, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaDescriptionAsBoth.stories'], | ||
}, | ||
}; | ||
export const OfMetaAsComponentComment: Story = { | ||
args: { | ||
of: DefaultButtonStories.default, | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'] }, | ||
}; | ||
export const OfMetaAsMetaComment: Story = { | ||
args: { | ||
of: ButtonStoriesWithMetaDescriptionAsComment.default, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaDescriptionAsComment.stories'], | ||
}, | ||
}; | ||
export const OfMetaAsParameter: Story = { | ||
args: { | ||
of: ButtonStoriesWithMetaDescriptionAsParameter.default, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaDescriptionAsParameter.stories'], | ||
}, | ||
}; | ||
export const OfMetaAsMetaCommentAndParameter: Story = { | ||
args: { | ||
of: ButtonStoriesWithMetaDescriptionAsBoth.default, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaDescriptionAsBoth.stories'], | ||
}, | ||
}; | ||
export const OfStoryAsComment: Story = { | ||
args: { | ||
of: DefaultButtonStories.Primary, | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'] }, | ||
}; | ||
export const OfStoryAsParameter: Story = { | ||
args: { | ||
of: DefaultButtonStories.Secondary, | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'] }, | ||
}; | ||
export const OfStoryAsStoryCommentAndParameter: Story = { | ||
args: { | ||
of: DefaultButtonStories.Large, | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'] }, | ||
}; | ||
export const OfUndefinedAttached: Story = { | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'], attached: true }, | ||
}; | ||
export const OfStringComponentAttached: Story = { | ||
name: 'Of "component" Attached', | ||
args: { | ||
of: 'component', | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'], attached: true }, | ||
}; | ||
export const OfStringMetaAttached: Story = { | ||
name: 'Of "meta" Attached', | ||
args: { | ||
of: 'meta', | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'], attached: true }, | ||
}; | ||
export const OfStringStoryAttached: Story = { | ||
name: 'Of "story" Attached', | ||
args: { | ||
of: 'story', | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'], attached: true }, | ||
}; |
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
Oops, something went wrong.