PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.7.0
Block Animations, Motion & Scroll Effects – Ghost Kit v3.7.0
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 / dropdown-picker / index.js

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

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