♻️ Integrate the new TabNavigation component

This commit is contained in:
Philipp Stracker 2024-10-28 15:47:53 +01:00
parent 3c31297e10
commit 7ecbd6a1ca
No known key found for this signature in database
3 changed files with 13 additions and 44 deletions

View file

@ -1,43 +1,19 @@
import { TabPanel } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
const onSelect = ( tabName ) => {
console.log( 'Selecting tab', tabName );
};
const TabNavigation = ( { tabs } ) => {
const updatePanelUri = ( tabName ) => {
};
const TabNavigation = () => {
return (
<TabPanel
className="my-tab-panel"
activeClass="active-tab"
onSelect={ onSelect }
tabs={ [
{
name: 'dashboard',
title: __( 'Dashboard', 'woocommerce-paypal-payments' ),
className: 'ppcp-r-tab-dashboard',
},
{
name: 'payment-methods',
title: __(
'Payment Methods',
'woocommerce-paypal-payments'
),
className: 'ppcp-r-tab-payment-methods',
},
{
name: 'settings',
title: __( 'Settings', 'woocommerce-paypal-payments' ),
className: 'ppcp-r-tab-settings',
},
{
name: 'styling',
title: __( 'Styling', 'woocommerce-paypal-payments' ),
className: 'ppcp-r-tab-styling',
},
] }
className={ `ppcp-r-tabs ${ panel }` }
onSelect={ updatePanelUri }
tabs={ tabs }
>
{ ( tab ) => <p>{ tab.title }</p> }
{ ( tab ) => {
return tab.component || <>{ tab.title ?? tab.name }</>;
} }
</TabPanel>
);
};