diff --git a/src/editor/components/CodeView.js b/src/editor/components/CodeView.js index ff76a7f9..dafb40c2 100644 --- a/src/editor/components/CodeView.js +++ b/src/editor/components/CodeView.js @@ -28,6 +28,14 @@ const CodeView = ( { themeConfig } ) => { return rest; } + /** + * If the current location is the site settings path, return the entire + * settings object. + */ + if ( location.path === '/settings' ) { + const { blocks, elements, ...rest } = themeConfig.settings; + return rest; + } /** * Remove the leading slash from the path so we don't end up with * an empty string as the first part of the pathParts array. diff --git a/src/editor/components/ComponentSettings/Settings.js b/src/editor/components/ComponentSettings/Settings.js new file mode 100644 index 00000000..d3539461 --- /dev/null +++ b/src/editor/components/ComponentSettings/Settings.js @@ -0,0 +1,177 @@ +import { Panel, PanelBody } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; +import { useContext } from '@wordpress/element'; + +import EditorContext from '../../context/EditorContext'; + +import SettingsAppearanceTools from './SettingsAppearanceTools'; +import SettingsBorder from './SettingsBorder'; +import SettingsColor from './SettingsColor'; +import SettingsCustomCSS from './SettingsCustomCSS'; +import SettingsLayout from './SettingsLayout'; +import SettingsSpacing from './SettingsSpacing'; +import TypographySettings from './TypographySettings'; +import SettingsDimensions from './SettingsDimensions'; +import SettingsShadow from './SettingsShadow'; +import SettingsPosition from './SettingsPosition'; +import SettingsBackground from './SettingsBackground'; + +/** + * Settings component + * + * This component will render the settings components for the given selector. + * + * + * @param {Object} props Component props + * @param {string} props.selector Selector for settings object within theme config + */ +const Settings = ( { selector } ) => { + const { schema } = useContext( EditorContext ); + + if ( ! selector ) { + return; + } + + const definitions = schema?.definitions; + + return ( +
+ { description } +
+ ) } ++ { description } +
+ ) } ++ { description } +
+ ) } ++ { description } +
+ ) } ++ { description } +
+ ) } + ++ { description } +
+ ) } ++ { description } +
+ ) } ++ { description } +
+ ) } ++ { description } +
+ ) } ++ { description } +
+ ) } ++ { __( 'Customise the appearance of the site.', 'themer' ) } +
++ { description } +
+ ) } +