PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / trunk
LatePoint – Calendar Booking Plugin for Appointments and Events vtrunk
5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / blocks / controls / ColorSelectorControl.js
latepoint / blocks / controls Last commit date
BorderControl.js 1 year ago BoxShadowControl.js 1 year ago ColorSelectorControl.js 1 year ago FontSizeControl.js 1 year ago LatepointIcons.js 1 year ago LetterSpacingControl.js 1 year ago LineHeightControl.js 1 year ago PaddingBoxControl.js 1 year ago TypographyControl.js 1 year ago
ColorSelectorControl.js
35 lines
1 import {__} from '@wordpress/i18n';
2 import {Dropdown, Button, ColorIndicator, ColorPalette} from '@wordpress/components';
3 import {select} from '@wordpress/data';
4 import React, {useMemo} from "react";
5
6 const ColorSelectorControl = ({label, colorAttribute, attributes, setAttributes}) => {
7 const colors = useMemo(() => select('core/block-editor').getSettings().colors, []);
8 const renderColorPicker = () => (
9 <ColorPalette
10 value={attributes[colorAttribute]}
11 colors={colors}
12 enableAlpha
13 onChange={(color) => setAttributes({[colorAttribute]: color})}
14 />
15 );
16
17 return (
18 <>
19 <Dropdown
20 className="lb-color-settings-dropdown"
21 renderToggle={({isOpen, onToggle}) => (
22 <div className="lb-row lb-color-settings-w">
23 <div className="lb-label">{__(label)}</div>
24 <Button onClick={onToggle} aria-expanded={isOpen}>
25 <ColorIndicator className="lb-color-indicator" colorValue={attributes[colorAttribute]}/>
26 </Button>
27 </div>
28 )}
29 renderContent={renderColorPicker}
30 />
31 </>
32 );
33 };
34
35 export default ColorSelectorControl;