PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / icon / edit / color-controls.js

color-controls.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/blocks/icon/edit/color-controls.js

53 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {
2 __experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
3 __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
4 InspectorControls,
5 } from '@wordpress/block-editor';
6 import { __ } from '@wordpress/i18n';
7
8 export default function ColorControls(props) {
9 const { attributes, setAttributes, clientId } = props;
10 const { color, backgroundColor, backgroundGradient } = attributes;
11
12 const colorGradientSettings = useMultipleOriginColorsAndGradients();
13
14 return colorGradientSettings.hasColorsOrGradients ? (
15 <InspectorControls group="color">
16 <ColorGradientSettingsDropdown
17 __experimentalIsRenderedInSidebar
18 settings={[
19 {
20 colorValue: color,
21 label: __('Icon', 'ghostkit'),
22 onColorChange: (val) => {
23 setAttributes({ color: val });
24 },
25 isShownByDefault: true,
26 resetAllFilter: () => ({
27 color: undefined,
28 }),
29 },
30 {
31 colorValue: backgroundColor,
32 gradientValue: backgroundGradient,
33 label: __('Background', 'ghostkit'),
34 onColorChange: (val) => {
35 setAttributes({ backgroundColor: val });
36 },
37 onGradientChange: (val) => {
38 setAttributes({ backgroundGradient: val });
39 },
40 isShownByDefault: true,
41 resetAllFilter: () => ({
42 backgroundColor: undefined,
43 backgroundGradient: undefined,
44 }),
45 },
46 ]}
47 panelId={clientId}
48 {...colorGradientSettings}
49 />
50 </InspectorControls>
51 ) : null;
52 }
53