woocommerce/plugins/woocommerce-admin/client/settings/index.js

48 lines
993 B
JavaScript
Raw Normal View History

2024-05-28 23:32:10 +00:00
/**
* External dependencies
*/
2024-05-29 03:41:08 +00:00
import { getQuery } from '@woocommerce/navigation';
2024-05-28 23:32:10 +00:00
/**
* Internal dependencies
*/
import { Tabs } from './tabs';
2024-05-29 01:38:10 +00:00
import { SectionNav } from './section-nav';
2024-05-29 03:41:08 +00:00
import { Content } from './content';
2024-05-29 00:17:39 +00:00
import './style.scss';
2024-05-28 23:32:10 +00:00
const Settings = ( { params } ) => {
const settingsData = window.wcSettings?.admin?.settingsPages;
2024-05-29 03:41:08 +00:00
const { section } = getQuery();
2024-05-28 23:32:10 +00:00
if ( ! settingsData ) {
return <div>Error getting data</div>;
}
return (
<>
2024-05-29 00:47:56 +00:00
<Tabs data={ settingsData } page={ params.page }>
2024-05-29 01:49:40 +00:00
<div className="woocommerce-settings-layout">
<div className="woocommerce-settings-section-nav">
2024-05-29 03:41:08 +00:00
<SectionNav
data={ settingsData[ params.page ] }
section={ section }
/>
2024-05-29 01:49:40 +00:00
</div>
<div className="woocommerce-settings-content">
2024-05-29 03:41:08 +00:00
<Content
data={
2024-05-30 01:37:04 +00:00
settingsData[ params.page ].sections[
section || ''
]
2024-05-29 03:41:08 +00:00
}
/>
2024-05-29 01:49:40 +00:00
</div>
2024-05-29 01:38:10 +00:00
</div>
2024-05-29 00:47:56 +00:00
</Tabs>
2024-05-28 23:32:10 +00:00
</>
);
};
2024-05-28 23:32:10 +00:00
export default Settings;