PluginProbe
Vimeography: Vimeo Video Gallery WordPress Plugin / 2.2
Vimeography: Vimeo Video Gallery WordPress Plugin v2.2
2.4.9 2.4.8 trunk 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 0.6 0.6.1 0.6.2 0.6.3 0.6.4 0.6.5 0.6.6 0.6.7 0.6.8 0.6.8.1 0.6.9 0.6.9.1 0.6.9.2 0.7 0.8 All 103 releases
vimeography / lib / admin / app / src / components / GalleryEditor / AppearanceEditor / Numeric.tsx

Numeric.tsx in Vimeography: Vimeo Video Gallery WordPress Plugin 2.2, at lib/admin/app/src/components/GalleryEditor/AppearanceEditor/Numeric.tsx

42 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import * as React from "react";
2 import InputNumber from "rc-input-number";
3 import "rc-input-number/assets/index.css";
4
5 import { ThemeSetting } from "~/providers/Themes";
6 import GalleryContext from "~/context/Gallery";
7
8 type ControlProps = {
9 setting: ThemeSetting;
10 };
11
12 const NumericControl = (props: ControlProps) => {
13 const setting = props.setting;
14 const [value, setValue] = React.useState(parseInt(setting.value));
15 const ctx = React.useContext(GalleryContext);
16
17 const handleChange = (value: number) => {
18 setValue(value);
19 ctx.dispatch({
20 type: `UPDATE_GALLERY_APPEARANCE`,
21 payload: { ...setting, value },
22 });
23 };
24
25 return (
26 <div>
27 <div className="vm-font-semibold vm-mb-2">{setting.label}</div>
28 <InputNumber
29 value={value}
30 defaultValue={setting.value}
31 min={setting.min}
32 max={setting.max}
33 step={setting.step}
34 formatter={(val) => `${val}px`}
35 onChange={handleChange}
36 />
37 </div>
38 );
39 };
40
41 export default NumericControl;
42