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

44 lines
840 B
JavaScript
Raw Normal View History

2024-05-29 03:41:08 +00:00
/**
* Internal dependencies
*/
import { SettingsCheckbox } from './components';
export const Content = ( { data } ) => {
const { settings } = data;
2024-05-29 05:24:19 +00:00
console.log( settings );
2024-05-29 03:41:08 +00:00
return (
<div>
2024-05-30 00:46:53 +00:00
{ settings.map( ( setting, idx ) => {
const key = setting.id || setting.title || idx;
2024-05-29 03:41:08 +00:00
switch ( setting.type ) {
case 'title':
2024-05-29 05:24:19 +00:00
return (
2024-05-29 10:39:02 +00:00
<div
2024-05-30 00:46:53 +00:00
key={ key }
2024-05-29 10:39:02 +00:00
className="woocommerce-settings-element"
>
2024-05-29 05:24:19 +00:00
<h3>{ setting.title }</h3>
</div>
);
2024-05-29 03:41:08 +00:00
case 'checkbox':
return (
2024-05-30 00:46:53 +00:00
<SettingsCheckbox setting={ setting } key={ key } />
2024-05-29 03:41:08 +00:00
);
2024-05-30 02:28:29 +00:00
case 'slotfill_placeholder':
return (
<div
key={ key }
id={ setting.id }
className={ setting.class }
></div>
);
2024-05-29 03:41:08 +00:00
default:
return null;
}
} ) }
</div>
);
};