-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Blocks: Add of
prop to Subtitle
#22552
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
84b1609
Fix typo
joaonunomota 764c819
Add of prop and deprecate componentSubtitle
joaonunomota 75564f3
Shorten declaring componentSubtitle and docs
joaonunomota bd34ef7
Fix autodocs link
joaonunomota bba00d9
Add missing parameter change documentation
joaonunomota b8e2820
Fix DEPRECATION_MIGRATION_LINK in Subtitle
joaonunomota dad7e2d
Merge branch 'next' into subtitle-of-prop
joaonunomota 3a209e2
Fix grammar
joaonunomota 0baa41a
Merge branch 'storybookjs:next' into subtitle-of-prop
joaonunomota 266266d
Update subtitle block props into alphabetical order
joaonunomota 3830eef
Merge branch 'next' into subtitle-of-prop
joaonunomota 4b05aa8
Update MIGRATION.md
joaonunomota c40902b
Merge branch 'next' into subtitle-of-prop
joaonunomota bc623d1
Merge branch 'next' into pr/joaonunomota/22552
ndelangen 5c20d18
Merge branch 'next' of github.com:storybookjs/storybook into subtitle…
JReinhold 6dadc7c
fix migration
JReinhold 3889e83
rename Subtitle stories
JReinhold 1c204ea
Merge branch 'next' into subtitle-of-prop
JReinhold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import React from 'react'; | ||
import { Subtitle } from './Subtitle'; | ||
import * as DefaultButtonStories from '../examples/Button.stories'; | ||
import * as ButtonStoriesWithMetaSubtitleInBoth from '../examples/ButtonWithMetaSubtitleInBoth.stories'; | ||
import * as ButtonStoriesWithMetaSubtitleInComponentSubtitle from '../examples/ButtonWithMetaSubtitleInComponentSubtitle.stories'; | ||
import * as ButtonStoriesWithMetaSubtitleInDocsSubtitle from '../examples/ButtonWithMetaSubtitleInDocsSubtitle.stories'; | ||
|
||
const meta: Meta<typeof Subtitle> = { | ||
component: Subtitle, | ||
parameters: { | ||
controls: { | ||
include: [], | ||
hideNoControlsWarning: true, | ||
}, | ||
// workaround for https://github.com/storybookjs/storybook/issues/20505 | ||
docs: { source: { type: 'code' } }, | ||
attached: false, | ||
docsStyles: true, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const OfCSFFileInBoth: Story = { | ||
args: { | ||
of: ButtonStoriesWithMetaSubtitleInBoth, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaSubtitleInBoth.stories'], | ||
}, | ||
}; | ||
export const OfCSFFileInComponentSubtitle: Story = { | ||
name: 'Of CSF File In parameters.componentSubtitle', | ||
args: { | ||
of: ButtonStoriesWithMetaSubtitleInComponentSubtitle, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaSubtitleInComponentSubtitle.stories'], | ||
}, | ||
}; | ||
export const OfCSFFileInDocsSubtitle: Story = { | ||
name: 'Of CSF File In parameters.docs.subtitle', | ||
args: { | ||
of: ButtonStoriesWithMetaSubtitleInDocsSubtitle, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaSubtitleInDocsSubtitle.stories'], | ||
}, | ||
}; | ||
export const OfMetaInBoth: Story = { | ||
args: { | ||
of: ButtonStoriesWithMetaSubtitleInBoth.default, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaSubtitleInBoth.stories'], | ||
}, | ||
}; | ||
export const OfMetaInComponentSubtitle: Story = { | ||
name: 'Of Meta In parameters.componentSubtitle', | ||
args: { | ||
of: ButtonStoriesWithMetaSubtitleInComponentSubtitle.default, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaSubtitleInComponentSubtitle.stories'], | ||
}, | ||
}; | ||
export const OfMetaInDocsSubtitle: Story = { | ||
name: 'Of Meta In parameters.docs.subtitle', | ||
args: { | ||
of: ButtonStoriesWithMetaSubtitleInDocsSubtitle.default, | ||
}, | ||
parameters: { | ||
relativeCsfPaths: ['../examples/ButtonWithMetaSubtitleInDocsSubtitle.stories'], | ||
}, | ||
}; | ||
export const DefaultAttached: Story = { | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'], attached: true }, | ||
}; | ||
export const OfUndefinedAttached: Story = { | ||
args: { | ||
// @ts-expect-error this is supposed to be undefined | ||
// eslint-disable-next-line import/namespace | ||
of: DefaultButtonStories.NotDefined, | ||
}, | ||
parameters: { | ||
chromatic: { disableSnapshot: true }, | ||
relativeCsfPaths: ['../examples/Button.stories'], | ||
attached: true, | ||
}, | ||
decorators: [(s) => (window?.navigator.userAgent.match(/StorybookTestRunner/) ? <div /> : s())], | ||
}; | ||
export const OfStringMetaAttached: Story = { | ||
name: 'Of "meta" Attached', | ||
args: { | ||
of: 'meta', | ||
}, | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'], attached: true }, | ||
}; | ||
export const Children: Story = { | ||
parameters: { relativeCsfPaths: ['../examples/Button.stories'], attached: true }, | ||
render: () => <Subtitle>This subtitle is set inside the Subtitle element.</Subtitle>, | ||
}; |
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
29 changes: 29 additions & 0 deletions
29
code/ui/blocks/src/examples/ButtonWithMetaSubtitleInBoth.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,29 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Button } from './Button'; | ||
|
||
const meta = { | ||
title: 'examples/Button with Meta Subtitle in Both', | ||
component: Button, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
parameters: { | ||
// Stop *this* story from being stacked in Chromatic | ||
theme: 'default', | ||
// this is to test the deprecated features of the Subtitle block | ||
componentSubtitle: 'This subtitle is set in parameters.componentSubtitle', | ||
docs: { | ||
subtitle: 'This subtitle is set in parameters.docs.subtitle', | ||
}, | ||
}, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const WithMetaSubtitleInBoth: Story = { | ||
args: { | ||
primary: true, | ||
label: 'Button', | ||
}, | ||
}; |
26 changes: 26 additions & 0 deletions
26
code/ui/blocks/src/examples/ButtonWithMetaSubtitleInComponentSubtitle.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,26 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Button } from './Button'; | ||
|
||
const meta = { | ||
title: 'examples/Button with Meta Subtitle in componentSubtitle', | ||
component: Button, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
parameters: { | ||
// Stop *this* story from being stacked in Chromatic | ||
theme: 'default', | ||
// this is to test the deprecated features of the Subtitle block | ||
componentSubtitle: 'This subtitle is set in parameters.componentSubtitle', | ||
}, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const WithMetaSubtitleInComponentSubtitle: Story = { | ||
args: { | ||
primary: true, | ||
label: 'Button', | ||
}, | ||
}; |
27 changes: 27 additions & 0 deletions
27
code/ui/blocks/src/examples/ButtonWithMetaSubtitleInDocsSubtitle.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,27 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Button } from './Button'; | ||
|
||
const meta = { | ||
title: 'examples/Button with Meta Subtitle in docs.subtitle', | ||
component: Button, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
parameters: { | ||
// Stop *this* story from being stacked in Chromatic | ||
theme: 'default', | ||
docs: { | ||
subtitle: 'This subtitle is set in parameters.docs.subtitle', | ||
}, | ||
}, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const WithMetaSubtitleInDocsSubtitle: Story = { | ||
args: { | ||
primary: true, | ||
label: 'Button', | ||
}, | ||
}; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks for updating the API reference! ❤️
Could you please keep these props in alphabetical order?
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.
Sorted :)