Skip to content
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

Tabs: fix "With tab icons" Storybook example #63297

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Fix inaccessibly disabled `Button`s ([#62306](https://github.com/WordPress/gutenberg/pull/62306)).
- `TimePicker`: Fix time zone overflow ([#63209](https://github.com/WordPress/gutenberg/pull/63209)).
- `Tabs`: Fix text-align when text wraps in vertical mode ([#63272](https://github.com/WordPress/gutenberg/pull/63272)).
- `Tabs`: Fix "With tab icons" Storybook example ([#63297](https://github.com/WordPress/gutenberg/pull/63297)).

### Internal

Expand Down
43 changes: 25 additions & 18 deletions packages/components/src/tabs/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import Tabs from '..';
import { Slot, Fill, Provider as SlotFillProvider } from '../../slot-fill';
import DropdownMenu from '../../dropdown-menu';
import Button from '../../button';
import Tooltip from '../../tooltip';
import Icon from '../../icon';

const meta: Meta< typeof Tabs > = {
title: 'Components (Experimental)/Tabs',
Expand Down Expand Up @@ -110,24 +112,29 @@ const WithTabIconsAndTooltipsTemplate: StoryFn< typeof Tabs > = ( props ) => {
return (
<Tabs { ...props }>
<Tabs.TabList>
<Tabs.Tab
tabId="tab1"
render={
<Button icon={ wordpress } label="Tab 1" showTooltip />
}
/>
<Tabs.Tab
tabId="tab2"
render={
<Button icon={ link } label="Tab 2" showTooltip />
}
/>
<Tabs.Tab
tabId="tab3"
render={
<Button icon={ more } label="Tab 3" showTooltip />
}
/>
{ [
{
id: 'tab1',
label: 'Tab one',
icon: wordpress,
},
{
id: 'tab2',
label: 'Tab two',
icon: link,
},
{
id: 'tab3',
label: 'Tab three',
icon: more,
},
].map( ( { id, label, icon } ) => (
<Tooltip text={ label } key={ id }>
<Tabs.Tab tabId={ id } aria-label={ label }>
<Icon icon={ icon } />
</Tabs.Tab>
</Tooltip>
) ) }
</Tabs.TabList>
<Tabs.TabPanel tabId="tab1">
<p>Selected tab: Tab 1</p>
Expand Down
Loading