40 lines
986 B
TypeScript
40 lines
986 B
TypeScript
/**
|
|
* External dependencies
|
|
*/
|
|
import { InspectorControls } from '@wordpress/block-editor';
|
|
import { PanelBody, ToggleControl } from '@wordpress/components';
|
|
import { __ } from '@wordpress/i18n';
|
|
import { BlockAttributes } from '@wordpress/blocks';
|
|
|
|
export const BlockSettings = ( {
|
|
attributes,
|
|
setAttributes,
|
|
}: {
|
|
attributes: BlockAttributes;
|
|
setAttributes: ( attrs: BlockAttributes ) => void;
|
|
} ) => {
|
|
const { hasDarkControls } = attributes;
|
|
return (
|
|
<InspectorControls>
|
|
<PanelBody title={ __( 'Style', 'woo-gutenberg-products-block' ) }>
|
|
<ToggleControl
|
|
label={ __(
|
|
'Dark mode inputs',
|
|
'woo-gutenberg-products-block'
|
|
) }
|
|
help={ __(
|
|
'Inputs styled specifically for use on dark background colors.',
|
|
'woo-gutenberg-products-block'
|
|
) }
|
|
checked={ hasDarkControls }
|
|
onChange={ () =>
|
|
setAttributes( {
|
|
hasDarkControls: ! hasDarkControls,
|
|
} )
|
|
}
|
|
/>
|
|
</PanelBody>
|
|
</InspectorControls>
|
|
);
|
|
};
|