PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.8
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.8
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / src / global-settings / breakpoint / breakpoint.js

breakpoint.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at src/global-settings/breakpoint/breakpoint.js

76 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __, _x } from "@wordpress/i18n";
2 import { PanelBody, __experimentalInputControl as InputControl, Button } from "@wordpress/components";
3
4 import { MobileIcon, TabletIcon } from "../../components/responsive/icon";
5 import "./editor.scss";
6 import { useDispatch, useSelect } from "@wordpress/data";
7 import { Divider } from "../../components";
8 import { ResetIcon } from "../../icons/icons";
9
10 const Breakpoint = () => {
11 const breakpoint = useSelect((select) => select("smartpost/global-settings").getCategory("breakpoint"));
12
13 const { updateSetting } = useDispatch("smartpost/global-settings");
14
15 const breakpointChange = (newValue, key) => {
16 updateSetting("breakpoint", key, newValue);
17 };
18
19 const resetBreakpoint = (key) => {
20 const resetValue = {
21 container: 1200,
22 tablet: 1023,
23 mobile: 767,
24 }
25 updateSetting("breakpoint", key, resetValue[key]);
26 };
27
28 return (
29 <PanelBody title={__("Responsive Breakpoints", "post-carousel")} initialOpen={false}>
30 <div className="sp-smart-breakpoint-header">
31 <span>Tablet Max Width</span>
32 <Button
33 onClick={() => resetBreakpoint("tablet")}
34 className={`sp-smart-breakpoint-reset ${1023 != breakpoint?.tablet ? "active" : ""}`}
35 >
36 <ResetIcon />
37 </Button>
38 </div>
39 <div className="sp-smart-breakpoint">
40 <div className="sp-smart-breakpoint-icon">
41 <TabletIcon />
42 </div>
43 <InputControl
44 type="number"
45 value={breakpoint?.tablet}
46 onChange={(newValue) => breakpointChange(newValue, "tablet")}
47 />
48 <span>Px</span>
49 </div>
50
51 <div className="sp-smart-breakpoint-header">
52 <span>Mobile Max Width</span>
53 <Button
54 onClick={() => resetBreakpoint("mobile")}
55 className={`sp-smart-breakpoint-reset ${767 != breakpoint?.mobile ? "active" : ""}`}
56 >
57 <ResetIcon />
58 </Button>
59 </div>
60 <div className="sp-smart-breakpoint">
61 <div className="sp-smart-breakpoint-icon">
62 <MobileIcon />
63 </div>
64 <InputControl
65 type="number"
66 value={breakpoint?.mobile}
67 onChange={(newValue) => breakpointChange(newValue, "mobile")}
68 />
69 <span>Px</span>
70 </div>
71 </PanelBody>
72 );
73 };
74
75 export default Breakpoint;
76