get routing working
This commit is contained in:
parent
e774182158
commit
5342b6cbcc
|
@ -18,7 +18,11 @@ const Settings = ( { params } ) => {
|
|||
|
||||
return (
|
||||
<>
|
||||
<Tabs data={ settingsData } page={ params.page } />
|
||||
<Tabs data={ settingsData } page={ params.page }>
|
||||
<p>
|
||||
now editing <span>{ params.page }</span>
|
||||
</p>
|
||||
</Tabs>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { TabPanel } from '@wordpress/components';
|
||||
import { getNewPath, navigateTo } from '@woocommerce/navigation';
|
||||
|
||||
export const Tabs = ( { data, page } ) => {
|
||||
export const Tabs = ( { data, page, children } ) => {
|
||||
const onSelect = ( tabName ) => {
|
||||
console.log( 'Selecting tab', tabName );
|
||||
const url = getNewPath( {}, `/settings/${ tabName }` );
|
||||
navigateTo( { url } );
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -20,7 +22,7 @@ export const Tabs = ( { data, page } ) => {
|
|||
title: data[ key ].label,
|
||||
} ) ) }
|
||||
>
|
||||
{ ( tab ) => <p>{ tab.title }</p> }
|
||||
{ () => <div>{ children }</div> }
|
||||
</TabPanel>
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue