PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 2.25.0
Block Animations, Motion & Scroll Effects – Ghost Kit v2.25.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 / image-picker / index.js

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

48 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * External dependencies
3 */
4 import classnames from 'classnames/dedupe';
5
6 /**
7 * WordPress dependencies
8 */
9 const { Component } = wp.element;
10
11 const { BaseControl } = wp.components;
12
13 /**
14 * Component Class
15 */
16 export default class ImagePicker extends Component {
17 render() {
18 const { value, options, onChange, label } = this.props;
19
20 return (
21 <BaseControl label={label} className="ghostkit-component-image-picker">
22 {options.map((option) => (
23 // eslint-disable-next-line react/button-has-type
24 <button
25 key={`image-pircker-${option.value}`}
26 onClick={() => {
27 onChange(option.value);
28 }}
29 className={classnames(
30 'ghostkit-component-image-picker-item',
31 value === option.value ? 'ghostkit-component-image-picker-item-active' : '',
32 option.className
33 )}
34 >
35 {option.image && typeof option.image === 'string' ? (
36 <img src={option.image} alt={option.label || option.value} />
37 ) : (
38 ''
39 )}
40 {option.image && typeof option.image !== 'string' ? option.image : ''}
41 {option.label ? <span>{option.label}</span> : ''}
42 </button>
43 ))}
44 </BaseControl>
45 );
46 }
47 }
48