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 / smart-search / dynamicCss.js

dynamicCss.js in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.8, at src/blocks/smart-search/dynamicCss.js

795 lines 26.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { boxCss, colorControls, objectToCssString, spacingGenerate, wrapInMediaQuery } from "../shared/helpFn";
2
3 const cacheCss = { desktop: "", mobile: "", tablet: "" };
4 // eslint-disable-next-line no-unused-vars
5 const dynamicCss = (attributes, page = "frontend", currentDevice = "all") => {
6 const {
7 uniqueId,
8 hideOnDesktop,
9 hideOnTablet,
10 hideOnMobile,
11 searchFormPreset,
12 searchFormBorderRadius,
13 searchFormHoverBorderRadius,
14 searchFormBorderWidth,
15 searchFormHoverBorderWidth,
16 searchFormBorder,
17 searchFormHoverBorder,
18 searchFormBgColor,
19 searchFormPadding,
20 inputPlaceholderTypography,
21 inputPlaceholderColor,
22 inputPlaceholderFontSize,
23 inputPlaceholderLineHeight,
24 inputPlaceholderLatterSpacing,
25 inputPlaceholderWordSpacing,
26 searchFormWidth,
27 searchFormHeight,
28 searchFormAlignment,
29 searchButtonPosition,
30 searchIconDivider,
31 searchBtnLabelFontSize,
32 searchBtnLabelLineHeight,
33 searchBtnLabelTypography,
34 searchBtnLabelTextColor,
35 gapWithIcon,
36 searchButtonPadding,
37 searchButtonBorder,
38 searchButtonBorderRadius,
39 searchBtnBgColor,
40 searchButtonBorderWidth,
41 searchBtnReverse,
42 searchButtonIconSize,
43 searchButtonIconColor,
44 gapWithSearchField,
45 searchIcon,
46 searchIconDividerColor,
47 searchButtonHoverBorder,
48 searchButtonHoverBorderWidth,
49 searchResultBoxWidth,
50 searchResultBoxHeight,
51 searchResultColumns,
52 searchResultTitleFontSize,
53 searchResultTitleLineHeight,
54 searchResultTitleTypography,
55 searchResultMetaTypography,
56 searchResultMetaFontSize,
57 searchResultMetaLineHeight,
58 searchResultImgBorderRadius,
59 searchResultImageSize,
60 searchResultBoxPadding,
61 searchResultMetaColor,
62 searchResultItemSeparator,
63 displayType,
64 searchResultBoxBorderRadius,
65 searchResultItemSeparatorColor,
66 searchResultColumnGap,
67 searchResultImageContentGap,
68 searchResultDisplayType,
69 globalBreakPointData,
70 searchResultSpaceBetweenMeta,
71 searchResultTitleColor,
72 searchResultBoxBackground,
73 searchResultBoxBorder,
74 searchResultHoverBoxBorder,
75 searchResultBoxBorderWidth,
76 searchResultHoverBoxBorderWidth,
77 searchResultBoxHoverBorderRadius,
78 moreResultFontSize,
79 moreResultLineHeight,
80 moreResultLatterSpacing,
81 moreResultWordSpacing,
82 moreResultTypography,
83 moreResultColor,
84 popupCanvasPadding,
85 popupCanvasBorderRadius,
86 popupCanvasBgColor,
87 popupCanvasBorder,
88 popupCanvasHoverBorder,
89 popupCanvasBoxShadowEnable,
90 popupCanvasBoxShadowValue,
91 popupCanvasHoverBorderWidth,
92 popupCanvasBorderWidth,
93 popupCanvasMargin,
94 popupCanvasWidth,
95 popupHeadingFontSize,
96 popupHeadingLineHeight,
97 popupHeadingLatterSpacing,
98 popupHeadingWordSpacing,
99 popupHeadingColor,
100 popupHeadingTypography,
101 popupHeadingAlignment,
102 popupCloseBtnIconSize,
103 popupHeadingGap,
104 searchResultVerticalPosition,
105 searchResultHorizontalPosition,
106 searchResultHighlightColor,
107 } = attributes;
108
109 const searchFieldWrapper =
110 "smart-search-form-preset-four" === searchFormPreset
111 ? "sp-smart-post-search-input-wrapper"
112 : "sp-smart-post-search-form";
113 const triggerClass = displayType === "popup" ? "sp-smart-post-search-trigger" : "sp-smart-post-search-wrapper";
114 const popupWrapper = displayType === "popup" ? "sp-smart-post-search-wrapper" : "sp-smart-post-search-results";
115
116 const responsiveCss = (deviceType) => {
117 return [
118 {
119 class: `#${uniqueId} .sp-smart-post-search-form`,
120 styles: {
121 width: searchFormWidth?.device?.[deviceType] + searchFormWidth.unit?.[deviceType],
122 height: searchFormHeight?.device?.[deviceType] + searchFormHeight.unit?.[deviceType],
123 ...("smart-search-form-preset-four" === searchFormPreset && {
124 gap: gapWithSearchField.device?.[deviceType] + gapWithSearchField.unit?.[deviceType],
125 }),
126 },
127 },
128 {
129 class: `#${uniqueId} .sp-smart-post-search-wrapper .${searchFieldWrapper}`,
130 styles: {
131 "border-radius": spacingGenerate(searchFormBorderRadius, [deviceType]),
132 "border-width": spacingGenerate(searchFormBorderWidth, [deviceType]) + "!important",
133 padding: spacingGenerate(searchFormPadding, [deviceType]),
134 },
135 },
136 {
137 class: ` #${uniqueId} .sp-smart-post-search-wrapper .${searchFieldWrapper}:hover, #${uniqueId} .sp-smart-post-search-wrapper .${searchFieldWrapper}:focus-within`,
138 styles: {
139 "border-radius": spacingGenerate(searchFormHoverBorderRadius, [deviceType]),
140 "border-width": spacingGenerate(searchFormHoverBorderWidth, [deviceType]) + "!important",
141 },
142 },
143 {
144 class: `
145 #${uniqueId} .sp-smart-post-search-input,
146 #${uniqueId} .sp-smart-post-search-input::-webkit-input-placeholder
147 `,
148 styles: {
149 "font-size":
150 inputPlaceholderFontSize?.device?.[deviceType] + inputPlaceholderFontSize?.unit?.[deviceType],
151 "line-height": inputPlaceholderLineHeight?.device?.[deviceType],
152 "letter-spacing":
153 inputPlaceholderLatterSpacing?.device?.[deviceType] +
154 inputPlaceholderLatterSpacing?.unit?.[deviceType],
155 "word-spacing":
156 inputPlaceholderWordSpacing?.device?.[deviceType] +
157 inputPlaceholderWordSpacing?.unit?.[deviceType],
158 },
159 },
160 {
161 class: `
162 #${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-button
163 `,
164 styles: {
165 ...([
166 "smart-search-form-preset-three",
167 "smart-search-form-preset-four",
168 "smart-search-form-preset-five",
169 ].includes(searchFormPreset) && {
170 padding: spacingGenerate(searchButtonPadding, [deviceType]),
171 gap: gapWithIcon.device?.[deviceType] + gapWithIcon.unit?.[deviceType],
172 "font-size":
173 searchBtnLabelFontSize?.device?.[deviceType] + searchBtnLabelFontSize?.unit?.[deviceType],
174 "line-height": searchBtnLabelLineHeight?.device?.[deviceType],
175 "border-radius": spacingGenerate(searchButtonBorderRadius, [deviceType]),
176 "border-width": spacingGenerate(searchButtonBorderWidth, [deviceType]),
177 }),
178 },
179 },
180 {
181 class: `
182 #${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-button:hover
183 `,
184 styles: {
185 ...([
186 "smart-search-form-preset-three",
187 "smart-search-form-preset-four",
188 "smart-search-form-preset-five",
189 ].includes(searchFormPreset) && {
190 "border-width": spacingGenerate(searchButtonHoverBorderWidth, [deviceType]),
191 }),
192 },
193 },
194 {
195 class: `#${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-button .sp-smart-post-search-icon`,
196 styles: {
197 width: searchButtonIconSize?.device?.[deviceType] + searchButtonIconSize?.unit?.[deviceType],
198 height: searchButtonIconSize?.device?.[deviceType] + searchButtonIconSize?.unit?.[deviceType],
199 },
200 },
201 {
202 class: `#${uniqueId} .sp-smart-post-search-results`,
203 styles: {
204 width: searchResultBoxWidth?.device?.[deviceType] + searchResultBoxWidth?.unit?.[deviceType],
205 "max-height":
206 searchResultBoxHeight?.device?.[deviceType] + searchResultBoxHeight?.unit?.[deviceType],
207 "border-width": spacingGenerate(searchResultBoxBorderWidth, [deviceType]),
208 "border-radius": spacingGenerate(searchResultBoxBorderRadius, [deviceType]),
209 ...(displayType === "normal" && {
210 padding: spacingGenerate(searchResultBoxPadding, [deviceType]),
211 "border-radius": spacingGenerate(searchResultBoxBorderRadius, [deviceType]),
212 }),
213 },
214 },
215 {
216 class: `#${uniqueId} .sp-smart-post-search-results:hover`,
217 styles: {
218 "border-width": spacingGenerate(searchResultHoverBoxBorderWidth, [deviceType]),
219 "border-radius": spacingGenerate(searchResultBoxHoverBorderRadius, [deviceType]),
220 },
221 },
222 {
223 class: `#${uniqueId} .sp-smart-post-search-popup`,
224 styles: {
225 width: popupCanvasWidth?.device?.[deviceType] + popupCanvasWidth?.unit?.[deviceType],
226 padding: spacingGenerate(popupCanvasPadding, [deviceType]),
227 margin: spacingGenerate(popupCanvasMargin, [deviceType]),
228 "border-radius": spacingGenerate(popupCanvasBorderRadius, [deviceType]),
229 "box-shadow": boxCss(popupCanvasBoxShadowEnable, [deviceType], popupCanvasBoxShadowValue, "color"),
230 "border-width": spacingGenerate(popupCanvasBorderWidth, [deviceType]),
231 },
232 },
233 {
234 class: `#${uniqueId} .sp-smart-post-search-popup:hover`,
235 styles: {
236 "border-width": spacingGenerate(popupCanvasHoverBorderWidth, [deviceType]),
237 },
238 },
239 {
240 class: `#${uniqueId} .sp-smart-post-popup-heading`,
241 styles: {
242 "font-size": popupHeadingFontSize?.device?.[deviceType] + popupHeadingFontSize?.unit?.[deviceType],
243 "line-height": popupHeadingLineHeight?.device?.[deviceType],
244 "letter-spacing":
245 popupHeadingLatterSpacing?.device?.[deviceType] + popupHeadingLatterSpacing?.unit?.[deviceType],
246 "word-spacing":
247 popupHeadingWordSpacing?.device?.[deviceType] + popupHeadingWordSpacing?.unit?.[deviceType],
248 "margin-bottom": popupHeadingGap?.device?.[deviceType] + popupHeadingGap?.unit?.[deviceType],
249 },
250 },
251 {
252 class: `#${uniqueId} .sp-smart-post-popup-close-icon svg`,
253 styles: {
254 width: popupCloseBtnIconSize?.device?.[deviceType] + popupCloseBtnIconSize?.unit?.[deviceType],
255 height: popupCloseBtnIconSize?.device?.[deviceType] + popupCloseBtnIconSize?.unit?.[deviceType],
256 },
257 },
258 {
259 class: `#${uniqueId} .sp-smart-post-search-results .sp-smart-post-search-list`,
260 styles: {
261 "grid-template-columns": `repeat(${searchResultColumns.device?.[deviceType]}, 1fr)`,
262 "column-gap":
263 searchResultColumnGap?.device?.[deviceType] + searchResultColumnGap?.unit?.[deviceType],
264 "row-gap": searchResultColumnGap?.device?.[deviceType] + searchResultColumnGap?.unit?.[deviceType],
265 },
266 },
267 {
268 class: `#${uniqueId} .sp-smart-post-search-item:first-child`,
269 styles: {
270 ...(searchResultItemSeparator &&
271 searchResultColumns?.device?.[deviceType] === 1 &&
272 displayType === "normal" && {
273 "padding-top": 0,
274 }),
275 },
276 },
277 {
278 class: `#${uniqueId} .sp-smart-post-search-item`,
279 styles: {
280 gap:
281 searchResultImageContentGap?.device?.[deviceType] +
282 searchResultImageContentGap?.unit?.[deviceType],
283 ...("smart-search-result-layout-three" === searchResultDisplayType && {
284 "border-radius": "4px",
285 border: "1px solid rgba(0, 0, 0, 0.10)",
286 background: "#FFFFFF",
287 "box-shadow": "4px 4px 12px 0 rgba(0, 0, 0, 0.08)",
288 }),
289 },
290 },
291 {
292 class: `#${uniqueId} .sp-smart-post-search-item:last-child`,
293 styles: {
294 ...(searchResultItemSeparator &&
295 searchResultColumns?.device?.[deviceType] === 1 && {
296 "border-bottom": "none !important",
297 }),
298 },
299 },
300 {
301 class: `#${uniqueId} .sp-smart-post-search-item .sp-smart-post-search-item-img img`,
302 styles: {
303 "border-radius": spacingGenerate(searchResultImgBorderRadius, [deviceType]),
304 width:
305 "smart-search-result-layout-one" === searchResultDisplayType
306 ? searchResultImageSize?.device?.[deviceType] + searchResultImageSize?.unit?.[deviceType]
307 : "100%",
308 height: searchResultImageSize?.device?.[deviceType] + searchResultImageSize?.unit?.[deviceType],
309 },
310 },
311 {
312 class: `#${uniqueId} .sp-smart-post-search-item-title`,
313 styles: {
314 "font-size":
315 searchResultTitleFontSize?.device?.[deviceType] + searchResultTitleFontSize?.unit?.[deviceType],
316 "line-height": searchResultTitleLineHeight?.device?.[deviceType],
317 },
318 },
319 {
320 class: `
321 #${uniqueId} .sp-smart-post-category a,
322 #${uniqueId} .sp-smart-post-details .sp-smart-post-meta-text,
323 #${uniqueId} .sp-smart-post-excerpt
324 `,
325 styles: {
326 "font-size":
327 searchResultMetaFontSize?.device?.[deviceType] + searchResultMetaFontSize?.unit?.[deviceType],
328 "line-height": searchResultMetaLineHeight?.device?.[deviceType],
329 },
330 },
331 {
332 class: `#${uniqueId} .sp-smart-post-search-item-excerpt`,
333 styles: {
334 "font-size": `calc(${
335 searchResultMetaFontSize?.device?.[deviceType] + searchResultMetaFontSize?.unit?.[deviceType]
336 } + 2px)`,
337 "line-height": searchResultMetaLineHeight?.device?.[deviceType],
338 },
339 },
340 {
341 class: `#${uniqueId} .sp-smart-post-search-item-desc`,
342 styles: {
343 gap: searchResultColumnGap?.device?.[deviceType] + searchResultColumnGap?.unit?.[deviceType],
344 },
345 },
346 {
347 class: `#${uniqueId} .sp-smart-post-meta-list`,
348 styles: {
349 gap:
350 searchResultSpaceBetweenMeta?.device?.[deviceType] +
351 searchResultSpaceBetweenMeta?.unit?.[deviceType],
352 },
353 },
354 {
355 class: `
356 #${uniqueId} .sp-smart-post-search-load-more .sp-smart-post-search-load-more-button
357 `,
358 styles: {
359 "font-size": moreResultFontSize?.device?.[deviceType] + moreResultFontSize?.unit?.[deviceType],
360 "line-height": moreResultLineHeight?.device?.[deviceType],
361 "letter-spacing":
362 moreResultLatterSpacing?.device?.[deviceType] + moreResultLatterSpacing?.unit?.[deviceType],
363 "word-spacing":
364 moreResultWordSpacing?.device?.[deviceType] + moreResultWordSpacing?.unit?.[deviceType],
365 color: moreResultColor?.color,
366 },
367 },
368 {
369 class: `
370 #${uniqueId} .sp-smart-post-search-load-more .sp-smart-post-search-load-more-button:hover
371 `,
372 styles: {
373 color: moreResultColor.hoverColor,
374 },
375 },
376 {
377 class: `#${uniqueId} .${popupWrapper}`,
378 styles: {
379 top:
380 searchResultVerticalPosition?.device?.[deviceType] +
381 searchResultVerticalPosition.unit?.[deviceType],
382 left:
383 searchResultHorizontalPosition?.device?.[deviceType] +
384 searchResultHorizontalPosition?.unit?.[deviceType],
385 },
386 },
387 {
388 class: `
389 #${uniqueId} .sp-smart-post-categories .sp-smart-post-category,
390 #${uniqueId} .sp-smart-post-excerpt,
391 #${uniqueId} .sp-smart-post-meta
392 `,
393 styles: {
394 "font-size":
395 searchResultMetaFontSize?.device?.[deviceType] + searchResultMetaFontSize?.unit?.[deviceType],
396 "line-height": searchResultMetaLineHeight?.device?.[deviceType],
397 },
398 },
399 ];
400 };
401
402 const desktopCss = [
403 ...responsiveCss("Desktop"),
404 {
405 class: `#${uniqueId} .${triggerClass}`,
406 styles: {
407 ...(displayType === "normal" && {
408 "align-items": searchFormAlignment,
409 }),
410 ...(displayType === "popup" && {
411 display: "flex",
412 "justify-content":
413 // eslint-disable-next-line no-nested-ternary
414 searchFormAlignment === "flex-start"
415 ? "start"
416 : searchFormAlignment === "flex-end"
417 ? "end"
418 : "center",
419 }),
420 },
421 },
422 {
423 class: `
424 #${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-input-wrapper`,
425 styles: {
426 order: searchButtonPosition === "left" ? 2 : 1,
427 ...("smart-search-form-preset-one" === searchFormPreset &&
428 "left" === searchButtonPosition && {
429 padding: "0 6px",
430 }),
431 },
432 },
433 {
434 class: `
435 #${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-input,
436 #${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-input:hover,
437 #${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-input:focus`,
438 styles: {
439 ...("smart-search-form-preset-four" !== searchFormPreset && {
440 padding: 0,
441 "background-color": "transparent",
442 margin: 0,
443 "border-radius": 0,
444 }),
445 ...("smart-search-form-preset-one" === searchFormPreset &&
446 "left" === searchButtonPosition && {
447 padding: "0 6px",
448 }),
449 },
450 },
451 {
452 class: `#${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-input::-webkit-input-placeholder`,
453 styles: {
454 "font-family": inputPlaceholderTypography?.typography?.family,
455 "font-weight": inputPlaceholderTypography?.typography?.fontWeight,
456 "font-style": inputPlaceholderTypography?.typography?.style,
457 "text-transform": inputPlaceholderTypography?.typography?.transform,
458 "text-decoration": inputPlaceholderTypography?.typography?.decoration,
459 color: inputPlaceholderColor?.color,
460 },
461 },
462 {
463 class: `
464 #${uniqueId} .sp-smart-post-search-form:hover .sp-smart-post-search-input::-webkit-input-placeholder,
465 #${uniqueId} .sp-smart-post-search-form:focus-within .sp-smart-post-search-input::-webkit-input-placeholder
466 `,
467 styles: {
468 color: inputPlaceholderColor?.hoverColor,
469 },
470 },
471 {
472 class: `#${uniqueId} .sp-smart-post-search-wrapper .${searchFieldWrapper}`,
473 styles: {
474 background: colorControls(
475 searchFormBgColor?.color?.style,
476 searchFormBgColor?.color?.solidColor,
477 searchFormBgColor?.color?.gradient
478 ),
479 "border-style": searchFormBorder.style,
480 "border-color": searchFormBorder.color,
481 },
482 },
483 {
484 class: `#${uniqueId} .sp-smart-post-search-wrapper .${searchFieldWrapper}:hover, #${uniqueId} .sp-smart-post-search-wrapper .${searchFieldWrapper}:focus-within`,
485 styles: {
486 background: colorControls(
487 searchFormBgColor?.hover?.style,
488 searchFormBgColor?.hover?.solidColor,
489 searchFormBgColor?.hover?.gradient
490 ),
491 "border-style": searchFormHoverBorder.style,
492 "border-color": searchFormHoverBorder.color,
493 },
494 },
495 {
496 class: `#${uniqueId} .sp-smart-post-search-button`,
497 styles: {
498 order: searchButtonPosition === "left" ? 1 : 2,
499 ...(["smart-search-form-preset-one", "smart-search-form-preset-two"].includes(searchFormPreset) && {
500 border: "none",
501 background: "transparent",
502 padding: 0,
503 [`padding-${searchButtonPosition === "right" ? "left" : "right"}`]: `6px`,
504 }),
505 ...(searchIconDivider &&
506 "smart-search-form-preset-one" === searchFormPreset &&
507 searchIcon && {
508 [`border-${searchButtonPosition === "right" ? "left" : "right"}`]: `1px solid ${searchIconDividerColor?.color}`,
509 }),
510 ...([
511 "smart-search-form-preset-three",
512 "smart-search-form-preset-four",
513 "smart-search-form-preset-five",
514 ].includes(searchFormPreset) && {
515 "flex-direction": searchBtnReverse ? "row-reverse" : "row",
516 background: colorControls(
517 searchBtnBgColor?.color?.style,
518 searchBtnBgColor?.color?.solidColor,
519 searchBtnBgColor?.color?.gradient
520 ),
521 "border-style": searchButtonBorder.style,
522 "border-color": searchButtonBorder.color,
523 "font-family": searchBtnLabelTypography?.typography?.family,
524 "font-weight": searchBtnLabelTypography?.typography?.fontWeight,
525 "font-style": searchBtnLabelTypography?.typography?.style,
526 "text-transform": searchBtnLabelTypography?.typography?.transform,
527 "text-decoration": searchBtnLabelTypography?.typography?.decoration,
528 color: searchBtnLabelTextColor?.color,
529 transition: "all .3s ease",
530 }),
531 },
532 },
533 {
534 class: `#${uniqueId} .sp-smart-post-search-button:hover`,
535 styles: {
536 ...([
537 "smart-search-form-preset-three",
538 "smart-search-form-preset-four",
539 "smart-search-form-preset-five",
540 ].includes(searchFormPreset) && {
541 background: colorControls(
542 searchBtnBgColor?.hover?.style,
543 searchBtnBgColor?.hover?.solidColor,
544 searchBtnBgColor?.hover?.gradient
545 ),
546 color: searchBtnLabelTextColor?.hoverColor,
547 "border-style": searchButtonHoverBorder.style,
548 "border-color": searchButtonHoverBorder.color,
549 ...(searchIconDivider &&
550 "smart-search-form-preset-one" === searchFormPreset &&
551 searchIcon && {
552 [`border-${searchButtonPosition === "right" ? "left" : "right"}`]: `1px solid ${searchIconDividerColor.hoverColor}`,
553 }),
554 }),
555 },
556 },
557 {
558 class: `#${uniqueId} .sp-smart-post-search-button .sp-smart-post-search-icon`,
559 styles: {
560 color: searchButtonIconColor?.color,
561 },
562 },
563 {
564 class: `#${uniqueId} .sp-smart-post-search-button:hover .sp-smart-post-search-icon`,
565 styles: {
566 color: searchButtonIconColor?.hoverColor,
567 },
568 },
569 {
570 class: `#${uniqueId} .sp-smart-post-search-form .sp-smart-post-search-icon`,
571 styles: {},
572 },
573 {
574 class: `#${uniqueId} .sp-smart-post-search-popup`,
575 styles: {
576 background: colorControls(
577 popupCanvasBgColor?.color?.style,
578 popupCanvasBgColor?.color?.solidColor,
579 popupCanvasBgColor?.color?.gradient
580 ),
581 "border-style": popupCanvasBorder.style,
582 "border-color": popupCanvasBorder.color,
583 },
584 },
585 {
586 class: `#${uniqueId} .sp-smart-post-search-popup.sp-smart-post-search-popup--active`,
587 styles: {
588 ...(searchResultDisplayType === "smart-search-result-layout-three" && {
589 position: "fixed",
590 }),
591 },
592 },
593 {
594 class: `#${uniqueId} .sp-smart-post-search-popup:hover`,
595 styles: {
596 background: colorControls(
597 popupCanvasBgColor?.hover?.style,
598 popupCanvasBgColor?.hover?.solidColor,
599 popupCanvasBgColor?.hover?.gradient
600 ),
601 "border-style": popupCanvasHoverBorder?.style,
602 "border-color": popupCanvasHoverBorder?.color,
603 },
604 },
605 {
606 class: `#${uniqueId} .sp-smart-post-popup-heading`,
607 styles: {
608 "font-family": popupHeadingTypography?.typography?.family,
609 "font-weight": popupHeadingTypography?.typography?.fontWeight,
610 "font-style": popupHeadingTypography?.typography?.style,
611 "text-transform": popupHeadingTypography?.typography?.transform,
612 "text-decoration": popupHeadingTypography?.typography?.decoration,
613 color: popupHeadingColor?.color,
614 "text-align": popupHeadingAlignment,
615 },
616 },
617 {
618 class: `#${uniqueId} .sp-smart-post-popup-heading:hover`,
619 styles: {
620 color: popupHeadingColor?.hoverColor,
621 },
622 },
623 {
624 class: `#${uniqueId} .sp-smart-post-search-results`,
625 styles: {
626 background: colorControls(
627 searchResultBoxBackground?.color?.style,
628 searchResultBoxBackground?.color?.solidColor,
629 searchResultBoxBackground?.color?.gradient
630 ),
631 "border-style": searchResultBoxBorder.style,
632 "border-color": searchResultBoxBorder.color,
633 ...(displayType === "normal" && {
634 "box-shadow": "0 4px 6px 0 rgba(0, 0, 0, 0.1)",
635 }),
636 },
637 },
638 {
639 class: `#${uniqueId} .sp-smart-post-search-results:hover`,
640 styles: {
641 background: colorControls(
642 searchResultBoxBackground?.hover?.style,
643 searchResultBoxBackground?.hover?.solidColor,
644 searchResultBoxBackground?.hover?.gradient
645 ),
646 "border-style": searchResultHoverBoxBorder?.style,
647 "border-color": searchResultHoverBoxBorder?.color,
648 },
649 },
650 {
651 class: `#${uniqueId} .sp-smart-post-search-item`,
652 styles: {
653 ...(searchResultDisplayType === "smart-search-result-layout-three" && {
654 "flex-direction": "column",
655 }),
656 ...(searchResultDisplayType !== "smart-search-result-layout-three" && {
657 "padding-bottom": "15px",
658 }),
659 ...(searchResultItemSeparator &&
660 "smart-search-result-layout-three" !== searchResultDisplayType && {
661 "border-bottom": `1px solid ${searchResultItemSeparatorColor?.color}`,
662 "padding-top": "15px",
663 }),
664 },
665 },
666 {
667 class: `#${uniqueId} .sp-smart-post-search-item-desc`,
668 styles: {
669 ...("smart-search-result-layout-three" === searchResultDisplayType && {
670 padding: "0px 8px 16px 8px",
671 }),
672 },
673 },
674 {
675 class: `#${uniqueId} .sp-smart-post-search-item-title`,
676 styles: {
677 "font-family": searchResultTitleTypography?.typography?.family,
678 "font-weight": searchResultTitleTypography?.typography?.fontWeight,
679 "font-style": searchResultTitleTypography?.typography?.style,
680 "text-transform": searchResultTitleTypography?.typography?.transform,
681 "text-decoration": searchResultTitleTypography?.typography?.decoration,
682 color: searchResultTitleColor?.color,
683 },
684 },
685 {
686 class: `#${uniqueId} .sp-smart-post-search-item-title:hover`,
687 styles: {
688 color: searchResultTitleColor?.hoverColor,
689 },
690 },
691 {
692 class: `
693 #${uniqueId} .sp-smart-post-category,
694 #${uniqueId} .sp-smart-post-meta,
695 #${uniqueId} .sp-smart-post-excerpt
696 `,
697 styles: {
698 margin: 0,
699 "font-family": searchResultMetaTypography?.typography?.family,
700 "font-weight": searchResultMetaTypography?.typography?.fontWeight,
701 "font-style": searchResultMetaTypography?.typography?.style,
702 "text-transform": searchResultMetaTypography?.typography?.transform,
703 "text-decoration": searchResultMetaTypography?.typography?.decoration,
704 },
705 },
706 {
707 class: `
708 #${uniqueId} .sp-smart-post-meta-list .sp-smart-post-meta,
709 #${uniqueId} .sp-smart-post-excerpt,
710 #${uniqueId} .sp-smart-post-category
711 `,
712 styles: {
713 color: searchResultMetaColor?.color,
714 },
715 },
716 {
717 class: `
718 #${uniqueId} .sp-smart-post-meta-list .sp-smart-post-meta:hover,
719 #${uniqueId} .sp-smart-post-excerpt:hover,
720 #${uniqueId} .sp-smart-post-category:hover
721 `,
722 styles: {
723 color: searchResultMetaColor?.hoverColor,
724 },
725 },
726 {
727 class: `
728 #${uniqueId} .sp-smart-post-search-load-more .sp-smart-post-search-load-more-button
729 `,
730 styles: {
731 "font-family": moreResultTypography?.typography?.family,
732 "font-weight": moreResultTypography?.typography?.fontWeight,
733 "font-style": moreResultTypography?.typography?.style,
734 "text-transform": moreResultTypography?.typography?.transform,
735 "text-decoration": moreResultTypography?.typography?.decoration,
736 },
737 },
738 {
739 class: `
740 #${uniqueId} .sp-smart-post-categories .sp-smart-post-category,
741 #${uniqueId} .sp-smart-post-excerpt,
742 #${uniqueId} .sp-smart-post-meta
743 `,
744 styles: {
745 "font-family": searchResultMetaTypography?.typography?.family,
746 "font-weight": searchResultMetaTypography?.typography?.fontWeight,
747 "font-style": searchResultMetaTypography?.typography?.style,
748 "text-transform": searchResultMetaTypography?.typography?.transform,
749 "text-decoration": searchResultMetaTypography?.typography?.decoration,
750 },
751 },
752 {
753 class: `
754 #${uniqueId} mark.sp-smart-post-search-highlight
755 `,
756 styles: {
757 color: searchResultHighlightColor?.color,
758 },
759 },
760 {
761 class: `
762 #${uniqueId} mark.sp-smart-post-search-highlight:hover
763 `,
764 styles: {
765 color: searchResultHighlightColor?.hoverColor,
766 },
767 },
768 ];
769
770 cacheCss.desktop = objectToCssString(desktopCss);
771
772 if ("Tablet" === currentDevice || "all" === currentDevice) {
773 const tabletCss = [
774 ...responsiveCss("Tablet")
775 ];
776 cacheCss.tablet = wrapInMediaQuery(
777 objectToCssString(tabletCss),
778 `only screen and (max-width: ${globalBreakPointData?.tablet}px)`
779 );
780 }
781
782 if ("Mobile" === currentDevice || "all" === currentDevice) {
783 const mobileCss = [
784 ...responsiveCss("Mobile")
785 ];
786 cacheCss.mobile = wrapInMediaQuery(
787 objectToCssString(mobileCss),
788 `only screen and (max-width: ${globalBreakPointData?.mobile}px)`
789 );
790 }
791 return `${cacheCss.desktop} ${cacheCss.tablet} ${cacheCss.mobile}`;
792 };
793
794 export default dynamicCss;
795