mirror of
https://gh.wpcy.net/https://github.com/elementor/hello-theme.git
synced 2026-04-29 12:32:22 +08:00
* Tweak: Added action links to the Theme Settings page * Lint * Lint * Update * Optimize logic * Lint * Lint * Update labels
68 lines
3.8 KiB
JavaScript
68 lines
3.8 KiB
JavaScript
import { __ } from '@wordpress/i18n';
|
|
import { PanelBody, ToggleControl, Notice, Dashicon } from '@wordpress/components';
|
|
|
|
export const SettingsPanel = ( { SETTINGS, settingsData, updateSettings } ) => {
|
|
const protocol = window.location.protocol || 'https:';
|
|
const hostname = window.location.hostname || 'example.com';
|
|
const prefix = protocol + '//' + hostname;
|
|
|
|
return (
|
|
<PanelBody title={ __( 'Hello Theme Settings', 'hello-elementor' ) } >
|
|
|
|
<Notice status="warning" isDismissible="false">
|
|
<Dashicon icon="flag" />
|
|
{ __( 'Be cautious, disabling some of the following options may break your website.', 'hello-elementor' ) }
|
|
</Notice>
|
|
|
|
<ToggleControl
|
|
label={ __( 'Disable description meta tag', 'hello-elementor' ) }
|
|
help={ __( 'Remove the description meta tag in singular content pages that contain an excerpt.', 'hello-elementor' ) }
|
|
checked={ !! settingsData[ SETTINGS.DESCRIPTION_META_TAG ] || false }
|
|
onChange={ ( value ) => updateSettings( SETTINGS.DESCRIPTION_META_TAG, value ) }
|
|
/>
|
|
<code className="code-example"> <meta name="description" content="..." /> </code>
|
|
|
|
<ToggleControl
|
|
label={ __( 'Disable skip link', 'hello-elementor' ) }
|
|
help={ __( 'Remove the "Skip to content" link used by screen-readers and users navigating with a keyboard.', 'hello-elementor' ) }
|
|
checked={ !! settingsData[ SETTINGS.SKIP_LINK ] || false }
|
|
onChange={ ( value ) => updateSettings( SETTINGS.SKIP_LINK, value ) }
|
|
/>
|
|
<code className="code-example"> <a class="skip-link screen-reader-text" href="#content"> Skip to content </a> </code>
|
|
|
|
<ToggleControl
|
|
label={ __( 'Disable cross-site header & footer', 'hello-elementor' ) }
|
|
help={ __( 'Remove the header & footer sections from all pages, and their CSS/JS files.', 'hello-elementor' ) }
|
|
checked={ !! settingsData[ SETTINGS.HEADER_FOOTER ] || false }
|
|
onChange={ ( value ) => updateSettings( SETTINGS.HEADER_FOOTER, value ) }
|
|
/>
|
|
<code className="code-example"> <header id="site-header" class="site-header"> ... </header> </code>
|
|
<code className="code-example"> <footer id="site-footer" class="site-footer"> ... </footer> </code>
|
|
|
|
<ToggleControl
|
|
label={ __( 'Disable page title', 'hello-elementor' ) }
|
|
help={ __( 'Remove the section above the content that contains the main heading of the page.', 'hello-elementor' ) }
|
|
checked={ !! settingsData[ SETTINGS.PAGE_TITLE ] || false }
|
|
onChange={ ( value ) => updateSettings( SETTINGS.PAGE_TITLE, value ) }
|
|
/>
|
|
<code className="code-example"> <header class="page-header"> <h1 class="entry-title"> Post title </h1> </header> </code>
|
|
|
|
<ToggleControl
|
|
label={ __( 'Unregister Hello style.css', 'hello-elementor' ) }
|
|
help={ __( "Disable Hello theme's style.css file which contains CSS reset rules for unified cross-browser view.", 'hello-elementor' ) }
|
|
checked={ !! settingsData[ SETTINGS.HELLO_STYLE ] || false }
|
|
onChange={ ( value ) => updateSettings( SETTINGS.HELLO_STYLE, value ) }
|
|
/>
|
|
<code className="code-example"> <link rel="stylesheet" href="{ prefix }/wp-content/themes/hello-elementor/style.min.css" /> </code>
|
|
|
|
<ToggleControl
|
|
label={ __( 'Unregister Hello theme.css', 'hello-elementor' ) }
|
|
help={ __( "Disable Hello theme's theme.css file which contains CSS rules that style WordPress elements.", 'hello-elementor' ) }
|
|
checked={ !! settingsData[ SETTINGS.HELLO_THEME ] || false }
|
|
onChange={ ( value ) => updateSettings( SETTINGS.HELLO_THEME, value ) }
|
|
/>
|
|
<code className="code-example"> <link rel="stylesheet" href="{ prefix }/wp-content/themes/hello-elementor/theme.min.css" /> </code>
|
|
|
|
</PanelBody>
|
|
);
|
|
};
|