PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.3
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.3
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.3.3, at gutenberg/components/dropdown-picker/index.js

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