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 / components / color-picker / index.js

index.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/components/color-picker/index.js

70 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import classnames from 'classnames/dedupe';
2
3 import { BaseControl, Button, Dropdown } from '@wordpress/components';
4
5 import ColorPalette from '../color-palette';
6
7 /**
8 * Component
9 *
10 * @param props
11 */
12 export default function ColorPicker(props) {
13 const {
14 value,
15 onChange,
16 label,
17 colorPalette = true,
18 alpha = false,
19 gradient = false, // PRO.
20 afterDropdownContent,
21 } = props;
22
23 return (
24 <BaseControl className="ghostkit-component-color-picker-wrapper">
25 <Dropdown
26 className="ghostkit-component-color-picker__dropdown"
27 contentClassName="ghostkit-component-color-picker__dropdown-content"
28 popoverProps={{
29 placement: 'left-start',
30 offset: 36,
31 shift: true,
32 }}
33 renderToggle={({ isOpen, onToggle }) => (
34 <Button
35 className={classnames(
36 'ghostkit-component-color-toggle',
37 isOpen
38 ? 'ghostkit-component-color-toggle-active'
39 : ''
40 )}
41 onClick={onToggle}
42 >
43 <span
44 className="ghostkit-component-color-toggle-indicator"
45 style={{ background: value || '' }}
46 />
47 <span className="ghostkit-component-color-toggle-label">
48 {label}
49 </span>
50 </Button>
51 )}
52 renderContent={() => (
53 <div className="ghostkit-component-color-picker">
54 <ColorPalette
55 value={value}
56 palette={colorPalette}
57 alpha={alpha}
58 gradient={gradient}
59 onChange={(color) => {
60 onChange(color || '');
61 }}
62 />
63 {afterDropdownContent || ''}
64 </div>
65 )}
66 />
67 </BaseControl>
68 );
69 }
70