From 979c44d044770af92cb563a7a99c49c731064e02 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 3 Jan 2025 02:52:32 +0900 Subject: [PATCH] Tabs: Remove unnecessary stories (#68463) Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla --- .../src/tabs/stories/index.story.tsx | 131 ------------------ 1 file changed, 131 deletions(-) diff --git a/packages/components/src/tabs/stories/index.story.tsx b/packages/components/src/tabs/stories/index.story.tsx index e434bb501d85c9..0502d6400a4f5c 100644 --- a/packages/components/src/tabs/stories/index.story.tsx +++ b/packages/components/src/tabs/stories/index.story.tsx @@ -15,7 +15,6 @@ import { useState } from '@wordpress/element'; */ 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'; @@ -367,133 +366,3 @@ const CloseButtonTemplate: StoryFn< typeof Tabs > = ( props ) => { ); }; export const InsertCustomElements = CloseButtonTemplate.bind( {} ); - -const ControlledModeTemplate: StoryFn< typeof Tabs > = ( props ) => { - const [ selectedTabId, setSelectedTabId ] = useState< - string | undefined | null - >( props.selectedTabId ); - - return ( - <> - { - setSelectedTabId( selectedId ); - props.onSelect?.( selectedId ); - } } - > - - Tab 1 - - Tab 2 - - Tab 3 - - -

Selected tab: Tab 1

-
- -

Selected tab: Tab 2

-
- -

Selected tab: Tab 3

-
-
-
-

Select a tab:

- setSelectedTabId( 'tab1' ), - title: 'Tab 1', - isActive: selectedTabId === 'tab1', - }, - { - onClick: () => setSelectedTabId( 'tab2' ), - title: 'Tab 2', - isActive: selectedTabId === 'tab2', - }, - { - onClick: () => setSelectedTabId( 'tab3' ), - title: 'Tab 3', - isActive: selectedTabId === 'tab3', - }, - ] } - label="Choose a tab. The power is yours." - /> -
- - ); -}; - -export const ControlledMode = ControlledModeTemplate.bind( {} ); -ControlledMode.args = { - selectedTabId: 'tab3', -}; - -const TabBecomesDisabledTemplate: StoryFn< typeof Tabs > = ( props ) => { - const [ disableTab2, setDisableTab2 ] = useState( false ); - - return ( - <> - - - - Tab 1 - - Tab 2 - - Tab 3 - - -

Selected tab: Tab 1

-
- -

Selected tab: Tab 2

-
- -

Selected tab: Tab 3

-
-
- - ); -}; -export const TabBecomesDisabled = TabBecomesDisabledTemplate.bind( {} ); - -const TabGetsRemovedTemplate: StoryFn< typeof Tabs > = ( props ) => { - const [ removeTab1, setRemoveTab1 ] = useState( false ); - - return ( - <> - - - - { ! removeTab1 && Tab 1 } - Tab 2 - Tab 3 - - -

Selected tab: Tab 1

-
- -

Selected tab: Tab 2

-
- -

Selected tab: Tab 3

-
-
- - ); -}; -export const TabGetsRemoved = TabGetsRemovedTemplate.bind( {} );