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 / live-filter / styleTab.js

styleTab.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.7, at src/blocks/live-filter/styleTab.js

565 lines 13.0 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 {
3 Border,
4 Spacing,
5 SpColorPicker,
6 SPRangeControl,
7 SPToggleGroupControl,
8 Toggle,
9 TypographyNew,
10 } from "../../components";
11 import { useState } from "@wordpress/element";
12
13 export const StyleTab = ({ attributes, setAttributes }) => {
14 const {
15 titleTypography,
16 titleFontSize,
17 titleLatterSpacing,
18 titleLineHeight,
19 titleWordSpacing,
20 optionTypography,
21 optionFontSize,
22 optionLatterSpacing,
23 optionLineHeight,
24 optionWordSpacing,
25 titleColor,
26 optionColor,
27 iconColor,
28 bgColor,
29 borderNormal,
30 borderHover,
31 borderWidthNormal,
32 borderWidthHover,
33 borderRadiusNormal,
34 borderRadiusHover,
35 padding,
36 margin,
37 titleGlobalTypography,
38 optionGlobalTypography,
39 layout,
40 activeBottomLine,
41 menuTypography,
42 menuFontSize,
43 menuLatterSpacing,
44 menuLineHeight,
45 menuWordSpacing,
46 menuGlobalTypography,
47 menuColor,
48 } = attributes;
49
50 const [colorType, setColorType] = useState("normal");
51
52 return (
53 <>
54 {"layoutTwo" === layout ? (
55 <>
56 <TypographyNew
57 attributes={{
58 family: menuTypography,
59 familyKey: "menuTypography",
60 fontSize: menuFontSize,
61 fontSizeKey: "menuFontSize",
62 fontSpacing: menuLatterSpacing,
63 fontSpacingKey: "menuLatterSpacing",
64 lineHeight: menuLineHeight,
65 lineHeightKey: "menuLineHeight",
66 wordSpacing: menuWordSpacing,
67 wordSpacingKey: "menuWordSpacing",
68 globalTypo: menuGlobalTypography,
69 globalTypoKey: "menuGlobalTypography",
70 }}
71 setAttributes={setAttributes}
72 spacingDefaultValue={{ unit: "px", value: 0 }}
73 fontSizeDefault={{
74 unit: "px",
75 value: 14,
76 }}
77 typographyLabel={__("Typography", "post-carousel")}
78 />
79
80 <Toggle
81 label={__("Active Bottom Line", "post-carousel")}
82 attributes={activeBottomLine}
83 attributesKey={"activeBottomLine"}
84 setAttributes={setAttributes}
85 />
86
87 <SPToggleGroupControl
88 attributes={colorType}
89 onClick={(newValue) => setColorType(newValue)}
90 items={[
91 {
92 label: "Normal",
93 value: "normal",
94 },
95 {
96 label: "Hover & Active",
97 value: "hover",
98 },
99 ]}
100 />
101
102 {"normal" === colorType && (
103 <>
104 <SpColorPicker
105 label={__("Color", "post-carousel")}
106 value={menuColor.color}
107 onChange={(newColor) =>
108 setAttributes({
109 menuColor: {
110 ...menuColor,
111 color: newColor,
112 },
113 })
114 }
115 defaultColor="#4E4F52"
116 />
117 </>
118 )}
119 {"hover" === colorType && (
120 <>
121 <SpColorPicker
122 label={__("Color", "post-carousel")}
123 value={menuColor.hover}
124 onChange={(newColor) =>
125 setAttributes({
126 menuColor: {
127 ...menuColor,
128 hover: newColor,
129 },
130 })
131 }
132 defaultColor="#4E4F52"
133 />
134 </>
135 )}
136 </>
137 ) : (
138 <>
139 <TypographyNew
140 attributes={{
141 family: titleTypography,
142 familyKey: "titleTypography",
143 fontSize: titleFontSize,
144 fontSizeKey: "titleFontSize",
145 fontSpacing: titleLatterSpacing,
146 fontSpacingKey: "titleLatterSpacing",
147 lineHeight: titleLineHeight,
148 lineHeightKey: "titleLineHeight",
149 wordSpacing: titleWordSpacing,
150 wordSpacingKey: "titleWordSpacing",
151 globalTypo: titleGlobalTypography,
152 globalTypoKey: "titleGlobalTypography",
153 }}
154 setAttributes={setAttributes}
155 spacingDefaultValue={{ unit: "px", value: 0 }}
156 fontSizeDefault={{
157 unit: "px",
158 value: 16,
159 }}
160 typographyLabel={__("Filter Title Typography", "post-carousel")}
161 />
162 <TypographyNew
163 attributes={{
164 family: optionTypography,
165 familyKey: "optionTypography",
166 fontSize: optionFontSize,
167 fontSizeKey: "optionFontSize",
168 fontSpacing: optionLatterSpacing,
169 fontSpacingKey: "optionLatterSpacing",
170 lineHeight: optionLineHeight,
171 lineHeightKey: "optionLineHeight",
172 wordSpacing: optionWordSpacing,
173 wordSpacingKey: "optionWordSpacing",
174 globalTypo: optionGlobalTypography,
175 globalTypoKey: "optionGlobalTypography",
176 }}
177 setAttributes={setAttributes}
178 spacingDefaultValue={{ unit: "px", value: 0 }}
179 fontSizeDefault={{
180 unit: "px",
181 value: "16",
182 }}
183 typographyLabel={__("Filter Option Typography", "post-carousel")}
184 />
185 <SpColorPicker
186 label={__("Title Color", "post-carousel")}
187 value={titleColor.color}
188 onChange={(newColor) =>
189 setAttributes({
190 titleColor: { ...titleColor, color: newColor },
191 })
192 }
193 defaultColor="#4E4F52"
194 />
195 <SPToggleGroupControl
196 attributes={colorType}
197 onClick={(newValue) => setColorType(newValue)}
198 items={[
199 {
200 label: "Normal",
201 value: "normal",
202 },
203 {
204 label: "Hover & Active",
205 value: "hover",
206 },
207 ]}
208 />
209 {"normal" === colorType && (
210 <>
211 <SpColorPicker
212 label={__("Option Color", "post-carousel")}
213 value={optionColor.color}
214 onChange={(newColor) =>
215 setAttributes({
216 optionColor: {
217 ...optionColor,
218 color: newColor,
219 },
220 })
221 }
222 defaultColor="#4E4F52"
223 />
224 <SpColorPicker
225 label={__("Background Color", "post-carousel")}
226 value={bgColor.color}
227 onChange={(newColor) =>
228 setAttributes({
229 bgColor: {
230 ...bgColor,
231 color: newColor,
232 },
233 })
234 }
235 defaultColor="#ffffff"
236 />
237 </>
238 )}
239 {"hover" === colorType && (
240 <>
241 <SpColorPicker
242 label={__("Option Color", "post-carousel")}
243 value={optionColor.hover}
244 onChange={(newColor) =>
245 setAttributes({
246 optionColor: {
247 ...optionColor,
248 hover: newColor,
249 },
250 })
251 }
252 defaultColor="#4E4F52"
253 />
254 <SpColorPicker
255 label={__("Background Color", "post-carousel")}
256 value={bgColor.hover}
257 onChange={(newColor) =>
258 setAttributes({
259 bgColor: {
260 ...bgColor,
261 hover: newColor,
262 },
263 })
264 }
265 defaultColor="#4E4F52"
266 />
267 {/* <Border
268 label="Border"
269 attributes={ {
270 border: borderHover,
271 borderWidth: borderWidthHover,
272 } }
273 setAttributes={ setAttributes }
274 attributesKey={ {
275 border: 'borderHover',
276 borderWidth: 'borderWidthHover',
277 } }
278 btnType="normal"
279 defaultColor= {{ color: '#838487' }}
280 />
281 <Spacing
282 label={ __(
283 'Border Radius',
284 'post-carousel'
285 ) }
286 attributes={ borderRadiusHover }
287 attributesKey={ 'borderRadiusHover' }
288 setAttributes={ setAttributes }
289 units={ [ 'px', '%', 'em' ] }
290 defaultValue={ {
291 unit: 'px',
292 value: {
293 top: 2,
294 right: 2,
295 bottom: 2,
296 left: 2,
297 },
298 } }
299 /> */}
300 </>
301 )}
302 <Border
303 label="Border"
304 attributes={{
305 border: borderNormal,
306 borderWidth: borderWidthNormal,
307 }}
308 setAttributes={setAttributes}
309 attributesKey={{
310 border: "borderNormal",
311 borderWidth: "borderWidthNormal",
312 }}
313 btnType="normal"
314 defaultColor={{ color: "#838487" }}
315 />
316 <Spacing
317 label={__("Border Radius", "post-carousel")}
318 attributes={borderRadiusNormal}
319 attributesKey={"borderRadiusNormal"}
320 setAttributes={setAttributes}
321 units={["px", "%", "em"]}
322 defaultValue={{
323 unit: "px",
324 value: {
325 top: 2,
326 right: 2,
327 bottom: 2,
328 left: 2,
329 },
330 }}
331 indicator={"radius"}
332 />
333
334 <Spacing
335 label={__("Padding", "post-carousel")}
336 attributes={padding}
337 attributesKey={"padding"}
338 setAttributes={setAttributes}
339 units={["px", "%", "em"]}
340 defaultValue={{
341 unit: "px",
342 value: {
343 top: 10,
344 right: 12,
345 bottom: 10,
346 left: 12,
347 },
348 }}
349 />
350 <Spacing
351 label={__("Margin", "post-carousel")}
352 attributes={margin}
353 attributesKey={"margin"}
354 setAttributes={setAttributes}
355 units={["px", "%", "em"]}
356 defaultValue={{
357 unit: "px",
358 value: {
359 top: 0,
360 right: 80,
361 bottom: 0,
362 left: 80,
363 },
364 }}
365 />
366 </>
367 )}
368 </>
369 );
370 };
371
372 export const HeadingStyle = ({ attributes, setAttributes }) => {
373 const {
374 headingTypography,
375 headingLineHeight,
376 headingWordSpacing,
377 headingLatterSpacing,
378 headingFontSize,
379 headingGlobalTypography,
380 headingColor,
381 widthLineThickness,
382 headingBg,
383 headingBorder,
384 headingBorderWidth,
385 headingBorderRadius,
386 headingPadding,
387 widthLineColor,
388 } = attributes;
389
390 const [colorType, setColorType] = useState("normal");
391
392 return (
393 <>
394 <TypographyNew
395 attributes={{
396 family: headingTypography,
397 familyKey: "headingTypography",
398 fontSize: headingFontSize,
399 fontSizeKey: "headingFontSize",
400 fontSpacing: headingLatterSpacing,
401 fontSpacingKey: "headingLatterSpacing",
402 lineHeight: headingLineHeight,
403 lineHeightKey: "headingLineHeight",
404 wordSpacing: headingWordSpacing,
405 wordSpacingKey: "headingWordSpacing",
406 globalTypo: headingGlobalTypography,
407 globalTypoKey: "headingGlobalTypography",
408 }}
409 setAttributes={setAttributes}
410 spacingDefaultValue={{ unit: "px", value: 0 }}
411 fontSizeDefault={{
412 unit: "px",
413 value: 18,
414 }}
415 typographyLabel={__("Typography", "post-carousel")}
416 />
417
418 <SPRangeControl
419 label={__("Full Width Line Thickness", "post-carousel")}
420 attributes={widthLineThickness}
421 attributesKey={"widthLineThickness"}
422 setAttributes={setAttributes}
423 max={10}
424 defaultValue={2}
425 />
426
427 <SPToggleGroupControl
428 attributes={colorType}
429 onClick={(newValue) => setColorType(newValue)}
430 items={[
431 {
432 label: "Normal",
433 value: "normal",
434 },
435 {
436 label: "Hover & Active",
437 value: "hover",
438 },
439 ]}
440 />
441 {"normal" === colorType && (
442 <>
443 <SpColorPicker
444 label={__("Color", "post-carousel")}
445 value={headingColor.color}
446 onChange={(newColor) =>
447 setAttributes({
448 headingColor: {
449 ...headingColor,
450 color: newColor,
451 },
452 })
453 }
454 defaultColor="#4E4F52"
455 />
456
457 <SpColorPicker
458 label={__("Full Width Line Color", "post-carousel")}
459 value={widthLineColor}
460 onChange={(newColor) =>
461 setAttributes({
462 widthLineColor: newColor,
463 })
464 }
465 defaultColor="#4E4F52"
466 />
467
468 <SpColorPicker
469 label={__("Background Color", "post-carousel")}
470 value={headingBg.color}
471 onChange={(newColor) =>
472 setAttributes({
473 headingBg: {
474 ...headingBg,
475 color: newColor,
476 },
477 })
478 }
479 defaultColor="#F05D31"
480 />
481 </>
482 )}
483 {"hover" === colorType && (
484 <>
485 <SpColorPicker
486 label={__("Color", "post-carousel")}
487 value={headingColor.hover}
488 onChange={(newColor) =>
489 setAttributes({
490 headingColor: {
491 ...headingColor,
492 hover: newColor,
493 },
494 })
495 }
496 defaultColor="#4E4F52"
497 />
498
499 <SpColorPicker
500 label={__("Background Color", "post-carousel")}
501 value={headingBg.hover}
502 onChange={(newColor) =>
503 setAttributes({
504 headingBg: {
505 ...headingBg,
506 hover: newColor,
507 },
508 })
509 }
510 defaultColor=""
511 />
512 </>
513 )}
514 <Border
515 label="Border"
516 attributes={{
517 border: headingBorder,
518 borderWidth: headingBorderWidth,
519 }}
520 setAttributes={setAttributes}
521 attributesKey={{
522 border: "headingBorder",
523 borderWidth: "headingBorderWidth",
524 }}
525 btnType="normal"
526 defaultColor={{ color: "#838487" }}
527 />
528 <Spacing
529 label={__("Border Radius", "post-carousel")}
530 attributes={headingBorderRadius}
531 attributesKey={"headingBorderRadius"}
532 setAttributes={setAttributes}
533 units={["px", "%", "em"]}
534 defaultValue={{
535 unit: "px",
536 value: {
537 top: 2,
538 right: 2,
539 bottom: 2,
540 left: 2,
541 },
542 }}
543 indicator={"radius"}
544 />
545
546 <Spacing
547 label={__("Padding", "post-carousel")}
548 attributes={headingPadding}
549 attributesKey={"headingPadding"}
550 setAttributes={setAttributes}
551 units={["px", "%", "em"]}
552 defaultValue={{
553 unit: "px",
554 value: {
555 top: 8,
556 right: 20,
557 bottom: 8,
558 left: 20,
559 },
560 }}
561 />
562 </>
563 );
564 };
565