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 / blocks / container / Inspector.js

Inspector.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at src/blocks/container/Inspector.js

71 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from "@wordpress/i18n";
2 import { useEffect, useState } from "@wordpress/element";
3 import { PanelBody } from "@wordpress/components";
4 import { TabControls } from "../../components";
5 import {
6 ContainerAdvancedGeneralTab,
7 ContainerFlexProperties,
8 ContainerGeneralTab,
9 ContainerShapeDivider,
10 } from "./generalTab";
11 import { ContainerAdvanceAdvancedTab, ContainerStyleTab, ContainerVisibilityTab } from "./styleTab";
12
13 const Inspector = ({ attributes, setAttributes, isSelected }) => {
14 const [togglePanel, setTogglePanel] = useState("container");
15
16 const toggleHandler = (toggleVal, tabName) => {
17 setTogglePanel(toggleVal ? tabName : "");
18 };
19 useEffect(() => {
20 setTogglePanel("container");
21 }, [isSelected]);
22
23 return (
24 <>
25 <PanelBody
26 title={__("Container Type", "post-carousel")}
27 opened={togglePanel === "container"}
28 onToggle={(value) => toggleHandler(value, "container")}
29 initialOpen={true}
30 >
31 <TabControls
32 attributes={attributes}
33 setAttributes={setAttributes}
34 GeneralTab={ContainerGeneralTab}
35 StyleTab={ContainerStyleTab}
36 />
37 </PanelBody>
38 <PanelBody
39 title={__("Flex Properties", "post-carousel")}
40 opened={togglePanel === "flex"}
41 onToggle={(value) => toggleHandler(value, "flex")}
42 >
43 <ContainerFlexProperties attributes={attributes} setAttributes={setAttributes} />
44 </PanelBody>
45 <PanelBody
46 title={__("Shape Divider", "post-carousel")}
47 opened={togglePanel === "shape-divider"}
48 onToggle={(value) => toggleHandler(value, "shape-divider")}
49 >
50 <ContainerShapeDivider attributes={attributes} setAttributes={setAttributes} />
51 </PanelBody>
52 <PanelBody
53 title={__("Advanced", "post-carousel")}
54 opened={togglePanel === "advance"}
55 onToggle={(value) => toggleHandler(value, "advance")}
56 >
57 <TabControls
58 attributes={attributes}
59 setAttributes={setAttributes}
60 displayIcon={false}
61 GeneralTab={ContainerAdvancedGeneralTab}
62 VisibilityTab={ContainerVisibilityTab}
63 AdvancedTab={ContainerAdvanceAdvancedTab}
64 />
65 </PanelBody>
66 </>
67 );
68 };
69
70 export default Inspector;
71