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 / shared / inspectors.js

inspectors.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.7, at src/blocks/shared/inspectors.js

314 lines 8.7 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 {
4 CarouselNavArrowGeneralTab,
5 CarouselPaginationGeneralTab,
6 CategoryGeneralTab,
7 ContentAreaGeneralTab,
8 ExcerptGeneralTab,
9 ImageGeneralTab,
10 MetaDataGeneralTab,
11 PopupDetailsGeneralTab,
12 QueryBuilderGeneralTab,
13 ReadMoreGeneralTab,
14 SocialShareGeneralTab,
15 TitleGeneralTab,
16 } from "./generalTab";
17
18 import { TabControls, Toggle } from "../../components";
19 import { VisibilityTab, AdvancedTab } from "./advancedTab";
20 import {
21 AdvancedStyleTab,
22 CarouselNavArrowStyleTab,
23 CarouselPaginationStyleTab,
24 CategoryStyleTab,
25 ContentAreaStyleTab,
26 ExcerptStyleTab,
27 ImageStyleTab,
28 MetaDataStyleTab,
29 PopupDetailsStyleTab,
30 ReadMoreStyleTab,
31 SocialShareStyleTab,
32 TitleStyleTab,
33 } from "./styleTab";
34
35 const SharedInspectors = ({ attributes, setAttributes, openedAccordion, togglePanelBody }) => {
36 const {
37 generalLinkOpen,
38 blockName,
39 postType,
40 carouselStyle,
41 carouselNavArrow,
42 carouselPaginationDot,
43 imageFeaturedImg,
44 titleShow,
45 catTabCategoryEnable,
46 excerptShow,
47 showReadMoreButton,
48 socialShareEnableSocial,
49 enableMetaData,
50 showFeatureVideo,
51 } = attributes;
52 const checkOpenedAccordion = (accordionName) => {
53 return openedAccordion === accordionName ? true : false;
54 };
55
56 return (
57 <>
58 {/* query builder panel body */}
59 <PanelBody
60 title={__("Query Builder", "post-carousel")}
61 opened={checkOpenedAccordion("query_builder")}
62 onToggle={() => togglePanelBody("query_builder")}
63 >
64 {checkOpenedAccordion("query_builder") && (
65 <QueryBuilderGeneralTab attributes={attributes} setAttributes={setAttributes} />
66 )}
67 </PanelBody>
68 {[
69 "post-carousel",
70 "post-slider",
71 "post-slider-two",
72 "post-thumbnail-slider",
73 "thumbnail-slider-two",
74 "post-timeline-three",
75 ].includes(blockName) &&
76 "ticker" !== carouselStyle && (
77 <>
78 {carouselNavArrow && (
79 <PanelBody
80 title={__("Navigation Arrow", "post-carousel")}
81 opened={checkOpenedAccordion("navigation")}
82 onToggle={() => togglePanelBody("navigation")}
83 >
84 {checkOpenedAccordion("navigation") && (
85 <TabControls
86 attributes={attributes}
87 setAttributes={setAttributes}
88 GeneralTab={CarouselNavArrowGeneralTab}
89 StyleTab={CarouselNavArrowStyleTab}
90 />
91 )}
92 </PanelBody>
93 )}
94 {!["thumbnail-slider-two"].includes(blockName) && carouselPaginationDot && (
95 <PanelBody
96 title={__("Pagination Dots", "post-carousel")}
97 opened={checkOpenedAccordion("pagination")}
98 onToggle={() => togglePanelBody("pagination")}
99 >
100 {checkOpenedAccordion("pagination") && (
101 <TabControls
102 attributes={attributes}
103 setAttributes={setAttributes}
104 GeneralTab={CarouselPaginationGeneralTab}
105 StyleTab={CarouselPaginationStyleTab}
106 />
107 )}
108 </PanelBody>
109 )}
110 </>
111 )}
112 {/* Popup details page */}
113 {(generalLinkOpen === "single-popup" || generalLinkOpen === "multi-popup") && (
114 <PanelBody
115 title={__("Popup Details Page", "post-carousel")}
116 opened={checkOpenedAccordion("popup_details_page")}
117 onToggle={() => togglePanelBody("popup_details_page")}
118 >
119 {checkOpenedAccordion("popup_details_page") && (
120 <TabControls
121 attributes={attributes}
122 setAttributes={setAttributes}
123 GeneralTab={PopupDetailsGeneralTab}
124 StyleTab={PopupDetailsStyleTab}
125 />
126 )}
127 </PanelBody>
128 )}
129 {/* timeline connector panel body for timeline category blocks */}
130 <PanelBody
131 title={__("Content Area", "post-carousel")}
132 opened={checkOpenedAccordion("content_area")}
133 onToggle={() => togglePanelBody("content_area")}
134 >
135 {checkOpenedAccordion("content_area") && (
136 <TabControls
137 attributes={attributes}
138 setAttributes={setAttributes}
139 GeneralTab={ContentAreaGeneralTab}
140 StyleTab={ContentAreaStyleTab}
141 />
142 )}
143 </PanelBody>
144 <PanelBody
145 title={__("Image and Video", "post-carousel")}
146 opened={checkOpenedAccordion("image")}
147 onToggle={() => togglePanelBody("image")}
148 >
149 <Toggle
150 label={__("Show Featured Image", "post-carousel")}
151 attributes={imageFeaturedImg}
152 attributesKey={"imageFeaturedImg"}
153 setAttributes={setAttributes}
154 />
155 <Toggle
156 label={__("Show Featured Video", "post-carousel")}
157 attributes={showFeatureVideo}
158 attributesKey={"showFeatureVideo"}
159 setAttributes={setAttributes}
160 pro={true}
161 />
162 {checkOpenedAccordion("image") && imageFeaturedImg && (
163 <TabControls
164 attributes={attributes}
165 setAttributes={setAttributes}
166 GeneralTab={ImageGeneralTab}
167 StyleTab={ImageStyleTab}
168 />
169 )}
170 </PanelBody>
171 <PanelBody
172 title={__("Title", "post-carousel")}
173 opened={checkOpenedAccordion("title")}
174 onToggle={() => togglePanelBody("title")}
175 >
176 <Toggle
177 label={__("Show Title", "post-carousel")}
178 attributes={titleShow}
179 attributesKey={"titleShow"}
180 setAttributes={setAttributes}
181 />
182 {checkOpenedAccordion("title") && titleShow && (
183 <TabControls
184 attributes={attributes}
185 setAttributes={setAttributes}
186 GeneralTab={TitleGeneralTab}
187 StyleTab={TitleStyleTab}
188 />
189 )}
190 </PanelBody>
191 <PanelBody
192 title={__("Taxonomy", "post-carousel")}
193 opened={checkOpenedAccordion("category")}
194 onToggle={() => togglePanelBody("category")}
195 >
196 <Toggle
197 label={__("Taxonomy", "post-carousel")}
198 attributes={catTabCategoryEnable}
199 attributesKey={"catTabCategoryEnable"}
200 setAttributes={setAttributes}
201 />
202 {checkOpenedAccordion("category") && catTabCategoryEnable && (
203 <TabControls
204 attributes={attributes}
205 setAttributes={setAttributes}
206 GeneralTab={CategoryGeneralTab}
207 StyleTab={CategoryStyleTab}
208 />
209 )}
210 </PanelBody>
211 <PanelBody
212 title={__("Meta Data", "post-carousel")}
213 opened={checkOpenedAccordion("meta_data")}
214 onToggle={() => togglePanelBody("meta_data")}
215 >
216 <Toggle
217 label={__("Show Meta Data", "post-carousel")}
218 attributes={enableMetaData}
219 attributesKey={"enableMetaData"}
220 setAttributes={setAttributes}
221 />
222 {checkOpenedAccordion("meta_data") && enableMetaData && (
223 <TabControls
224 attributes={attributes}
225 setAttributes={setAttributes}
226 GeneralTab={MetaDataGeneralTab}
227 StyleTab={MetaDataStyleTab}
228 />
229 )}
230 </PanelBody>
231 <PanelBody
232 title={__("Excerpt", "post-carousel")}
233 opened={checkOpenedAccordion("excerpt")}
234 onToggle={() => togglePanelBody("excerpt")}
235 >
236 <Toggle
237 label={__("Excerpt", "post-carousel")}
238 attributes={excerptShow}
239 setAttributes={setAttributes}
240 attributesKey={"excerptShow"}
241 />
242 {checkOpenedAccordion("excerpt") && excerptShow && (
243 <TabControls
244 attributes={attributes}
245 setAttributes={setAttributes}
246 GeneralTab={ExcerptGeneralTab}
247 StyleTab={ExcerptStyleTab}
248 />
249 )}
250 </PanelBody>
251 <PanelBody
252 title={__("Read More", "post-carousel")}
253 opened={checkOpenedAccordion("read_more")}
254 onToggle={() => togglePanelBody("read_more")}
255 >
256 <Toggle
257 label={__("Read More Button", "post-carousel")}
258 attributes={showReadMoreButton}
259 setAttributes={setAttributes}
260 attributesKey={"showReadMoreButton"}
261 />
262 {checkOpenedAccordion("read_more") && showReadMoreButton && (
263 <TabControls
264 attributes={attributes}
265 setAttributes={setAttributes}
266 GeneralTab={ReadMoreGeneralTab}
267 StyleTab={ReadMoreStyleTab}
268 />
269 )}
270 </PanelBody>
271 {"product" !== postType && (
272 <PanelBody
273 title={__("Social Share", "post-carousel")}
274 opened={checkOpenedAccordion("social_share")}
275 onToggle={() => togglePanelBody("social_share")}
276 >
277 <Toggle
278 label={__("Social Share", "post-carousel")}
279 attributes={socialShareEnableSocial}
280 attributesKey={"socialShareEnableSocial"}
281 setAttributes={setAttributes}
282 />
283 {checkOpenedAccordion("social_share") && socialShareEnableSocial && (
284 <TabControls
285 attributes={attributes}
286 setAttributes={setAttributes}
287 GeneralTab={SocialShareGeneralTab}
288 StyleTab={SocialShareStyleTab}
289 />
290 )}
291 </PanelBody>
292 )}
293 <PanelBody
294 title={__("Advanced", "post-carousel")}
295 opened={checkOpenedAccordion("advanced")}
296 onToggle={() => togglePanelBody("advanced")}
297 >
298 {checkOpenedAccordion("advanced") && (
299 <TabControls
300 attributes={attributes}
301 setAttributes={setAttributes}
302 displayIcon={false}
303 GeneralTab={AdvancedStyleTab}
304 VisibilityTab={VisibilityTab}
305 AdvancedTab={AdvancedTab}
306 />
307 )}
308 </PanelBody>
309 </>
310 );
311 };
312
313 export default SharedInspectors;
314