Set container width based on active tab panel

This commit is contained in:
Philipp Stracker 2024-10-28 15:56:11 +01:00
parent 5f0fb376fb
commit 69ca811b96
No known key found for this signature in database
5 changed files with 24 additions and 3 deletions

View file

@ -1,13 +1,18 @@
import { TabPanel } from '@wordpress/components';
import { useState } from '@wordpress/element';
const TabNavigation = ( { tabs } ) => {
const initialPanel = tabs[ 0 ].name;
const [ activePanel, setActivePanel ] = useState( initialPanel );
const updatePanelUri = ( tabName ) => {
setActivePanel( tabName );
};
return (
<TabPanel
className={ `ppcp-r-tabs ${ panel }` }
className={ `ppcp-r-tabs ${ activePanel }` }
initialTabName={ activePanel }
onSelect={ updatePanelUri }
tabs={ tabs }
>