Skip to content

Commit

Permalink
Tabs: fix "With tab icons" Storybook example (WordPress#63297)
Browse files Browse the repository at this point in the history
* Tabs: fix "With tab icons" Storybook example

* CHANGELOG

---

Co-authored-by: ciampo <[email protected]>
Co-authored-by: mirka <[email protected]>
  • Loading branch information
3 people authored and carstingaxion committed Jul 18, 2024
1 parent bf79c77 commit 8763d16
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- `TimePicker`: Fix time zone overflow ([#63209](https://github.com/WordPress/gutenberg/pull/63209)).
- `SelectControl`: Fix disabled styles ([#63266](https://github.com/WordPress/gutenberg/pull/63266)).
- `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

0 comments on commit 8763d16

Please sign in to comment.