PluginProbe
WebberZone Top 10 — Popular Posts / 4.3.2
WebberZone Top 10 — Popular Posts v4.3.2
4.5.1 4.5.0 4.4.3 4.4.2 4.4.1 4.4.0 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 1.6.1 All 117 releases
top-10 / includes / frontend / blocks / src / post-count / components / unit-control.js

unit-control.js in WebberZone Top 10 — Popular Posts 4.3.2, at includes/frontend/blocks/src/post-count/components/unit-control.js

46 lines 924 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { TextControl, SelectControl } from '@wordpress/components';
2 import { __ } from '@wordpress/i18n';
3
4 const UnitControl = ({
5 label,
6 value,
7 unit = 'px',
8 onValueChange,
9 onUnitChange,
10 options = [
11 { label: 'px', value: 'px' },
12 { label: 'em', value: 'em' },
13 { label: '%', value: '%' },
14 { label: 'rem', value: 'rem' },
15 ],
16 style = {},
17 }) => {
18 return (
19 <div className="unit-control" style={style}>
20 <div style={{ display: 'flex' }}>
21 <TextControl
22 label={label}
23 __nextHasNoMarginBottom
24 type="number"
25 value={value}
26 onChange={onValueChange}
27 style={{
28 flexGrow: 1,
29 marginBottom: 0,
30 }}
31 />
32 <SelectControl
33 label={__('Unit', 'top-10')}
34 __nextHasNoMarginBottom
35 value={unit}
36 options={options}
37 onChange={onUnitChange}
38 style={{ width: 'max-content', marginBottom: 0 }}
39 />
40 </div>
41 </div>
42 );
43 };
44
45 export default UnitControl;
46