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 / social-profiles / styleTab.js

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

387 lines 9.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 { useState } from "@wordpress/element";
3 import {
4 Background,
5 Border,
6 BoxShadow,
7 Divider,
8 Spacing,
9 SpColorPicker,
10 SPToggleGroupControl,
11 Toggle,
12 TypographyNew,
13 } from "../../components";
14 import { BgIcon, GradientIcon } from "../../components/background/svgIcon";
15
16 export const SocialProfilesIconStyleTab = ({ attributes, setAttributes }) => {
17 const {
18 socialIconCustomColorEnable,
19 socialIconColor,
20 socialIconBg,
21 socialIconBorder,
22 socialIconBorderWidth,
23 socialIconBorderRadius,
24 socialIconBorderHover,
25 socialIconBorderWidthHover,
26 socialIconBorderRadiusHover,
27 socialIconBoxShadowEnable,
28 socialIconBoxShadowValue,
29 socialIconBoxShadowHoverEnable,
30 socialIconBoxShadowHoverValue,
31 socialIconMargin,
32 layout,
33 socialIconDividerColor,
34 } = attributes;
35 const [colorState, setColorState] = useState("color");
36
37 return (
38 <>
39 <Toggle
40 label={__("Custom Icon Color", "post-carousel")}
41 attributes={socialIconCustomColorEnable}
42 attributesKey={"socialIconCustomColorEnable"}
43 setAttributes={setAttributes}
44 />
45 <SPToggleGroupControl
46 attributes={colorState}
47 onClick={(newValue) => setColorState(newValue)}
48 items={[
49 { label: "Normal", value: "color" },
50 { label: "Hover", value: "hover" },
51 ]}
52 />
53 {"social-profiles-layout-three" === layout && (
54 <>
55 {"color" === colorState ? (
56 <SpColorPicker
57 label={__("Divider Color", "post-carousel")}
58 value={socialIconDividerColor.color}
59 onChange={(newValue) =>
60 setAttributes({
61 socialIconDividerColor: {
62 ...socialIconDividerColor,
63 color: newValue,
64 },
65 })
66 }
67 />
68 ) : (
69 <SpColorPicker
70 label={__("Divider Hover Color", "post-carousel")}
71 value={socialIconDividerColor.hover}
72 onChange={(newValue) =>
73 setAttributes({
74 socialIconDividerColor: {
75 ...socialIconDividerColor,
76 hover: newValue,
77 },
78 })
79 }
80 />
81 )}
82 </>
83 )}
84 {socialIconCustomColorEnable && (
85 <>
86 {"color" === colorState ? (
87 <>
88 <SpColorPicker
89 label={__("Icon Color", "post-carousel")}
90 value={socialIconColor?.color}
91 onChange={(newValue) =>
92 setAttributes({
93 socialIconColor: {
94 ...socialIconColor,
95 color: newValue,
96 },
97 })
98 }
99 />
100 </>
101 ) : (
102 <>
103 <SpColorPicker
104 label={__("Icon Color", "post-carousel")}
105 value={socialIconColor?.hover}
106 onChange={(newValue) =>
107 setAttributes({
108 socialIconColor: {
109 ...socialIconColor,
110 hover: newValue,
111 },
112 })
113 }
114 />
115 </>
116 )}
117 <Background
118 label={__("Background Type", "post-carousel")}
119 attributes={socialIconBg}
120 attributesKey={"socialIconBg"}
121 setAttributes={setAttributes}
122 colorType={colorState}
123 items={[
124 {
125 label: <BgIcon />,
126 value: "bgColor",
127 tooltip: "Solid",
128 },
129 {
130 label: <GradientIcon />,
131 value: "gradient",
132 tooltip: "Gradient",
133 },
134 ]}
135 />
136 </>
137 )}
138 {"color" === colorState ? (
139 <>
140 <Border
141 attributes={{
142 border: socialIconBorder,
143 borderWidth: socialIconBorderWidth,
144 }}
145 attributesKey={{
146 border: "socialIconBorder",
147 borderWidth: "socialIconBorderWidth",
148 }}
149 setAttributes={setAttributes}
150 btnType={"normal"}
151 />
152 <Spacing
153 label={__("Border Radius", "post-carousel")}
154 attributes={socialIconBorderRadius}
155 attributesKey={"socialIconBorderRadius"}
156 setAttributes={setAttributes}
157 units={["px", "%", "em"]}
158 defaultValue={{
159 unit: "%",
160 value: { top: 0, right: 0, bottom: 0, left: 0 },
161 }}
162 indicator={"radius"}
163 />
164 <Toggle
165 label={__("Box Shadow", "post-carousel")}
166 attributes={socialIconBoxShadowEnable}
167 attributesKey={"socialIconBoxShadowEnable"}
168 setAttributes={setAttributes}
169 />
170 {socialIconBoxShadowEnable && (
171 <>
172 <BoxShadow
173 attributes={socialIconBoxShadowValue}
174 attributesKey={"socialIconBoxShadowValue"}
175 setAttributes={setAttributes}
176 />
177 </>
178 )}
179 </>
180 ) : (
181 <>
182 <Border
183 label={__("Border on Hover", "post-carousel")}
184 attributes={{
185 border: socialIconBorderHover,
186 borderWidth: socialIconBorderWidthHover,
187 }}
188 attributesKey={{
189 border: "socialIconBorderHover",
190 borderWidth: "socialIconBorderWidthHover",
191 }}
192 setAttributes={setAttributes}
193 btnType={colorState}
194 />
195 <Spacing
196 label={__("Border Radius on Hover", "post-carousel")}
197 attributes={socialIconBorderRadiusHover}
198 attributesKey={"socialIconBorderRadiusHover"}
199 setAttributes={setAttributes}
200 units={["px", "%", "em"]}
201 defaultValue={{
202 unit: "%",
203 value: { top: 0, right: 0, bottom: 0, left: 0 },
204 }}
205 indicator={"radius"}
206 />
207 <Toggle
208 label={__("Box Shadow on Hover", "post-carousel")}
209 attributes={socialIconBoxShadowHoverEnable}
210 attributesKey={"socialIconBoxShadowHoverEnable"}
211 setAttributes={setAttributes}
212 />
213 {socialIconBoxShadowHoverEnable && (
214 <>
215 <BoxShadow
216 attributes={socialIconBoxShadowHoverValue}
217 attributesKey={"socialIconBoxShadowHoverValue"}
218 setAttributes={setAttributes}
219 />
220 </>
221 )}
222 </>
223 )}
224 <Divider position={"sp-w-100pct bottom"} />
225 <Spacing
226 label={__("Margin", "post-carousel")}
227 attributes={socialIconMargin}
228 attributesKey={"socialIconMargin"}
229 setAttributes={setAttributes}
230 units={["px", "%", "em"]}
231 defaultValue={{
232 unit: "%",
233 value: { top: 0, right: 0, bottom: 0, left: 0 },
234 }}
235 />
236 </>
237 );
238 };
239
240 export const SocialProfilesLabelStyleTab = ({ attributes, setAttributes }) => {
241 const {
242 socialLabelTypography,
243 socialLabelFontSize,
244 socialLabelLetterSpacing,
245 socialLabelLineHeight,
246 socialLabelColor,
247 socialSubTextTypography,
248 socialSubTextFontSize,
249 socialSubTextLetterSpacing,
250 socialSubTextLineHeight,
251 socialSubTextColor,
252 socialLabelWordSpacing,
253 socialSubTextWordSpacing,
254 socialLabelEnable,
255 socialSubTextEnable,
256 socialLabelGlobalTypography,
257 socialSubTextGlobalTypography,
258 } = attributes;
259 const [colorState, setColorState] = useState("color");
260 return (
261 <>
262 {socialLabelEnable && (
263 <TypographyNew
264 attributes={{
265 family: socialLabelTypography,
266 familyKey: "socialLabelTypography",
267 fontSize: socialLabelFontSize,
268 fontSizeKey: "socialLabelFontSize",
269 fontSpacing: socialLabelLetterSpacing,
270 fontSpacingKey: "socialLabelLetterSpacing",
271 lineHeight: socialLabelLineHeight,
272 lineHeightKey: "socialLabelLineHeight",
273 wordSpacing: socialLabelWordSpacing,
274 wordSpacingKey: "socialLabelWordSpacing",
275 globalTypo: socialLabelGlobalTypography,
276 globalTypoKey: "socialLabelGlobalTypography",
277 }}
278 setAttributes={setAttributes}
279 spacingDefaultValue={{ unit: "px", value: 0 }}
280 fontSizeDefault={{
281 unit: "px",
282 value: 14,
283 }}
284 lineDefaultValue={1.2}
285 />
286 )}
287 {socialSubTextEnable && (
288 <TypographyNew
289 attributes={{
290 family: socialSubTextTypography,
291 familyKey: "socialSubTextTypography",
292 fontSize: socialSubTextFontSize,
293 fontSizeKey: "socialSubTextFontSize",
294 fontSpacing: socialSubTextLetterSpacing,
295 fontSpacingKey: "socialSubTextLetterSpacing",
296 lineHeight: socialSubTextLineHeight,
297 lineHeightKey: "socialSubTextLineHeight",
298 wordSpacing: socialSubTextWordSpacing,
299 wordSpacingKey: "socialSubTextWordSpacing",
300 globalTypo: socialSubTextGlobalTypography,
301 globalTypoKey: "socialSubTextGlobalTypography",
302 }}
303 setAttributes={setAttributes}
304 spacingDefaultValue={{ unit: "px", value: 0 }}
305 fontSizeDefault={{
306 unit: "px",
307 value: 14,
308 }}
309 lineDefaultValue={1.2}
310 typographyLabel={__("Sub Text Typography", "post-carousel")}
311 />
312 )}
313 <SPToggleGroupControl
314 attributes={colorState}
315 onClick={(newValue) => setColorState(newValue)}
316 items={[
317 { label: "Normal", value: "color" },
318 { label: "Hover", value: "hover" },
319 ]}
320 />
321 {"color" === colorState ? (
322 <>
323 {socialLabelEnable && (
324 <SpColorPicker
325 label={__("Color", "post-carousel")}
326 value={socialLabelColor.color}
327 onChange={(newValue) =>
328 setAttributes({
329 socialLabelColor: {
330 ...socialLabelColor,
331 color: newValue,
332 },
333 })
334 }
335 />
336 )}
337 {socialSubTextEnable && (
338 <SpColorPicker
339 label={__("Sub Text Color", "post-carousel")}
340 value={socialSubTextColor.color}
341 onChange={(newValue) =>
342 setAttributes({
343 socialSubTextColor: {
344 ...socialSubTextColor,
345 color: newValue,
346 },
347 })
348 }
349 />
350 )}
351 </>
352 ) : (
353 <>
354 {socialLabelEnable && (
355 <SpColorPicker
356 label={__("Color", "post-carousel")}
357 value={socialLabelColor.hoverColor}
358 onChange={(newValue) =>
359 setAttributes({
360 socialLabelColor: {
361 ...socialLabelColor,
362 hoverColor: newValue,
363 },
364 })
365 }
366 />
367 )}
368 {socialSubTextEnable && (
369 <SpColorPicker
370 label={__("Sub Text Color", "post-carousel")}
371 value={socialSubTextColor.hoverColor}
372 onChange={(newValue) =>
373 setAttributes({
374 socialSubTextColor: {
375 ...socialSubTextColor,
376 hoverColor: newValue,
377 },
378 })
379 }
380 />
381 )}
382 </>
383 )}
384 </>
385 );
386 };
387