mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
✨ Set container width based on active tab panel
This commit is contained in:
parent
5f0fb376fb
commit
69ca811b96
5 changed files with 24 additions and 3 deletions
|
@ -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 }
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue