PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.7
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.7
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 / table-of-content / inspector.js

inspector.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.7, at src/blocks/table-of-content/inspector.js

139 lines 3.8 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 { PanelBody } from "@wordpress/components";
3 import { SPRangeControl, TabControls } from "../../components";
4 import { AdvancedTab, VisibilityTab } from "../shared/advancedTab";
5
6 import { PresetToc, TocCollapsibleGeneral, TocHeading, TocListBodyGeneral } from "./generalTabs";
7 import { StyleTab, TocCollapsibleStyleTab, TocHeadingStyleTab, TocListBodyStyleTab } from "./styleTab";
8 import { usePanelBodyContext } from "../../context";
9 import Toggle from "../../components/toggle/toggle";
10
11 const Inspector = ({ attributes, setAttributes }) => {
12 const { openPanel, togglePanelBody } = usePanelBodyContext();
13 const { blockName, smoothScroll, backToTop, offsetTop } = attributes;
14
15 return (
16 <>
17 <PanelBody
18 title={__("Preset", "post-carousel")}
19 opened={openPanel === "preset"}
20 onToggle={() => togglePanelBody("preset")}
21 >
22 {openPanel === "preset" && (
23 <TabControls
24 attributes={attributes}
25 setAttributes={setAttributes}
26 Preset={PresetToc}
27 StyleTab={StyleTab}
28 displayIcon={true}
29 blockName={blockName}
30 initialTab={"preset"}
31 />
32 )}
33 </PanelBody>
34
35 <PanelBody
36 title={__("TOC Heading", "post-carousel")}
37 className="sp-smart-post-section-heading-block-panel-body"
38 opened={openPanel === "heading"}
39 onToggle={() => togglePanelBody("heading")}
40 >
41 {openPanel === "heading" && (
42 <TabControls
43 attributes={attributes}
44 setAttributes={setAttributes}
45 GeneralTab={TocHeading}
46 StyleTab={TocHeadingStyleTab}
47 displayIcon={true}
48 blockName={blockName}
49 />
50 )}
51 </PanelBody>
52
53 <PanelBody
54 opened={openPanel === "tocBody"}
55 onToggle={() => togglePanelBody("tocBody")}
56 title={__("TOC List Body", "post-carousel")}
57 className="sp-smart-post-section-heading-block-panel-body"
58 >
59 {openPanel === "tocBody" && (
60 <TabControls
61 attributes={attributes}
62 setAttributes={setAttributes}
63 GeneralTab={TocListBodyGeneral}
64 StyleTab={TocListBodyStyleTab}
65 displayIcon={true}
66 blockName={blockName}
67 />
68 )}
69 </PanelBody>
70
71 <PanelBody
72 opened={openPanel === "collapsible"}
73 onToggle={() => togglePanelBody("collapsible")}
74 title={__("Collapsible", "post-carousel")}
75 className="sp-smart-post-section-heading-block-panel-body"
76 >
77 {openPanel === "collapsible" && (
78 <TabControls
79 attributes={attributes}
80 setAttributes={setAttributes}
81 GeneralTab={TocCollapsibleGeneral}
82 StyleTab={TocCollapsibleStyleTab}
83 displayIcon={true}
84 blockName={blockName}
85 />
86 )}
87 </PanelBody>
88
89 <PanelBody
90 opened={openPanel === "scroll"}
91 onToggle={() => togglePanelBody("scroll")}
92 title={__("Scroll", "post-carousel")}
93 className="sp-smart-post-section-heading-block-panel-body"
94 >
95 <Toggle
96 label={__("Smooth Scroll", "post-carousel")}
97 attributes={smoothScroll}
98 attributesKey={"smoothScroll"}
99 setAttributes={setAttributes}
100 />
101
102 <SPRangeControl
103 label={__("Offset Top", "post-carousel")}
104 setAttributes={setAttributes}
105 attributes={offsetTop}
106 max={200}
107 min={1}
108 attributesKey={"offsetTop"}
109 defaultValue={{ unit: "", value: 50 }}
110 />
111 {/* <Toggle
112 label={__("Back to Top", "post-carousel")}
113 attributes={backToTop}
114 attributesKey={"backToTop"}
115 setAttributes={setAttributes}
116 /> */}
117
118 </PanelBody>
119
120 <PanelBody
121 opened={openPanel === "advanced"}
122 onToggle={() => togglePanelBody("advanced")}
123 title={__("Advanced", "post-carousel")}
124 >
125 <TabControls
126 attributes={attributes}
127 setAttributes={setAttributes}
128 AdvancedTab={AdvancedTab}
129 VisibilityTab={VisibilityTab}
130 displayIcon={false}
131 initialTab={"visibility"}
132 />
133 </PanelBody>
134 </>
135 );
136 };
137
138 export default Inspector;
139