| 1 |
import { |
| 2 |
objectToCssString, |
| 3 |
wrapInMediaQuery, |
| 4 |
boxCss, |
| 5 |
spacingGenerate, |
| 6 |
colorControls, |
| 7 |
getClipPathForShape, |
| 8 |
hexToRgba, |
| 9 |
} from "../shared/helpFn"; |
| 10 |
|
| 11 |
const dynamicCss = (attributes) => { |
| 12 |
const { |
| 13 |
uniqueId, |
| 14 |
listOrientation, |
| 15 |
iconContentGap, |
| 16 |
smartListsBg, |
| 17 |
smartListsBgImage, |
| 18 |
smartListsHoverBgImage, |
| 19 |
smartListsBgImageScale, |
| 20 |
smartListsBgHoverImageScale, |
| 21 |
bgImageOverlayEnable, |
| 22 |
bgImageOverlayColor, |
| 23 |
bgImageOverlayOpacity, |
| 24 |
bgImageOverlayHoverEnable, |
| 25 |
bgImageHoverOverlayOpacity, |
| 26 |
borderStyle, |
| 27 |
borderStyleWidth, |
| 28 |
borderRadius, |
| 29 |
padding, |
| 30 |
boxShadowEnable, |
| 31 |
boxShadow, |
| 32 |
iconPosition, |
| 33 |
margin, |
| 34 |
borderHoverStyleWidth, |
| 35 |
borderHoverRadius, |
| 36 |
boxShadowHoverEnable, |
| 37 |
boxShadowHover, |
| 38 |
iconBorderStyle, |
| 39 |
dividerStyle, |
| 40 |
dividerWidth, |
| 41 |
backgroundShape, |
| 42 |
titleDescriptionGap, |
| 43 |
titleTypography, |
| 44 |
titleColor, |
| 45 |
titleFontSize, |
| 46 |
titleLineHeight, |
| 47 |
titleLatterSpacing, |
| 48 |
iconSource, |
| 49 |
titleWordSpacing, |
| 50 |
descriptionTypography, |
| 51 |
descriptionColor, |
| 52 |
descriptionFontSize, |
| 53 |
descriptionLatterSpacing, |
| 54 |
descriptionWordSpacing, |
| 55 |
descriptionLineHeight, |
| 56 |
listsAlignment, |
| 57 |
iconBg, |
| 58 |
iconPadding, |
| 59 |
iconBorderRadius, |
| 60 |
iconBorderStyleWidth, |
| 61 |
iconColor, |
| 62 |
iconHoverBorderStyle, |
| 63 |
iconHoverBorderRadius, |
| 64 |
iconHoverBorderStyleWidth, |
| 65 |
iconBackgroundEnable, |
| 66 |
dividerColor, |
| 67 |
spaceBetweenLists, |
| 68 |
hideOnDesktop, |
| 69 |
hideOnTablet, |
| 70 |
hideOnMobile, |
| 71 |
iconSize, |
| 72 |
iconCustomWidth, |
| 73 |
iconCustomHeight, |
| 74 |
borderHoverStyle, |
| 75 |
svgIconName, |
| 76 |
iconAlignment, |
| 77 |
contentAlignment, |
| 78 |
listItemsWidth, |
| 79 |
} = attributes; |
| 80 |
|
| 81 |
const rangerCss = (attr, device = "Desktop") => { |
| 82 |
const unit = attr?.unit?.[device] || ""; |
| 83 |
return `${attr?.device?.[device]}${unit}`; |
| 84 |
}; |
| 85 |
|
| 86 |
const typographyCss = (attr) => { |
| 87 |
return { |
| 88 |
"font-family": attr.typography.family, |
| 89 |
"font-weight": attr.typography.fontWeight, |
| 90 |
"font-style": attr.typography.style, |
| 91 |
"text-decoration": attr.typography.decoration, |
| 92 |
"text-transform": attr.typography.transform, |
| 93 |
}; |
| 94 |
}; |
| 95 |
|
| 96 |
const generalCSS = () => { |
| 97 |
return [ |
| 98 |
{ |
| 99 |
class: `#${uniqueId}, #${uniqueId} .block-editor-block-list__layout`, |
| 100 |
styles: { |
| 101 |
"flex-direction": `${listOrientation === "horizontal" ? "row" : "column"}`, |
| 102 |
"align-items": listOrientation === "vertical" ? listsAlignment : "", |
| 103 |
"justify-content": listOrientation === "horizontal" ? listsAlignment : "", |
| 104 |
"row-gap": listOrientation === "horizontal" ? "12px" : "", |
| 105 |
}, |
| 106 |
}, |
| 107 |
|
| 108 |
{ |
| 109 |
class: `#${uniqueId}.divider.sp-list-orientation-horizontal .wp-block-sp-smart-post-show-smart-list.sp-list-divider .sp-smart-post-smart-list-wrapper`, |
| 110 |
styles: { |
| 111 |
"border-right-color": dividerColor, |
| 112 |
"border-right-style": dividerStyle, |
| 113 |
}, |
| 114 |
}, |
| 115 |
{ |
| 116 |
class: `#${uniqueId}.divider.sp-list-orientation-vertical .wp-block-sp-smart-post-show-smart-list .sp-smart-post-smart-list-wrapper`, |
| 117 |
styles: { |
| 118 |
"border-bottom-color": dividerColor, |
| 119 |
"border-bottom-style": dividerStyle, |
| 120 |
}, |
| 121 |
}, |
| 122 |
|
| 123 |
{ |
| 124 |
class: `#${uniqueId}.divider .wp-block-sp-smart-post-show-smart-list:last-child.wp-block-sp-smart-post-show-smart-list .sp-smart-post-list-wrapper`, |
| 125 |
styles: { |
| 126 |
border: "none !important", |
| 127 |
}, |
| 128 |
}, |
| 129 |
|
| 130 |
{ |
| 131 |
class: `#${uniqueId}.sp-smart-post-smart-lists-wrapper`, |
| 132 |
styles: { |
| 133 |
background: ` |
| 134 |
${colorControls( |
| 135 |
smartListsBg?.color?.style, |
| 136 |
smartListsBg?.color?.solidColor, |
| 137 |
smartListsBg?.color?.gradient, |
| 138 |
smartListsBgImage |
| 139 |
)}`, |
| 140 |
"background-size": smartListsBg.color.style === "image" ? smartListsBgImageScale : "", |
| 141 |
"border-style": borderStyle.style, |
| 142 |
"border-color": borderStyle.color, |
| 143 |
}, |
| 144 |
}, |
| 145 |
bgImageOverlayEnable &&{ |
| 146 |
class: `#${uniqueId}.sp-smart-post-smart-lists-wrapper::after`, |
| 147 |
styles: { |
| 148 |
background: bgImageOverlayColor.color, |
| 149 |
opacity: bgImageOverlayOpacity |
| 150 |
}, |
| 151 |
}, |
| 152 |
|
| 153 |
{ |
| 154 |
class: `#${uniqueId}.sp-smart-post-smart-lists-wrapper:hover`, |
| 155 |
styles: { |
| 156 |
background: `${ |
| 157 |
bgImageOverlayHoverEnable && smartListsBg.hover.style === "image" |
| 158 |
? `linear-gradient(${hexToRgba( |
| 159 |
bgImageOverlayColor.hoverColor, |
| 160 |
bgImageHoverOverlayOpacity |
| 161 |
)} )` |
| 162 |
: "linear-gradient(rgba(0, 0, 0, 0))" |
| 163 |
} ,${colorControls( |
| 164 |
smartListsBg?.hover?.style, |
| 165 |
smartListsBg?.hover?.solidColor, |
| 166 |
smartListsBg?.hover?.gradient, |
| 167 |
smartListsHoverBgImage |
| 168 |
)}`, |
| 169 |
"background-size": smartListsBg.hover.style === "image" ? smartListsBgHoverImageScale : "", |
| 170 |
"border-style": borderHoverStyle.style, |
| 171 |
"border-color": borderHoverStyle.color, |
| 172 |
}, |
| 173 |
}, |
| 174 |
|
| 175 |
{ |
| 176 |
class: `#${uniqueId} .wp-block-sp-smart-post-show-smart-list:last-child.wp-block-sp-smart-post-show-smart-list .sp-smart-post-list-wrapper`, |
| 177 |
styles: { |
| 178 |
"margin-bottom": "0px", |
| 179 |
"padding-bottom": "0px", |
| 180 |
}, |
| 181 |
}, |
| 182 |
|
| 183 |
{ |
| 184 |
class: `#${uniqueId}.layout-five .sp-smart-post-list-link`, |
| 185 |
styles: { |
| 186 |
"flex-direction": "column", |
| 187 |
}, |
| 188 |
}, |
| 189 |
]; |
| 190 |
}; |
| 191 |
|
| 192 |
const iconImageCSS = () => { |
| 193 |
return [ |
| 194 |
{ |
| 195 |
class: `#${uniqueId} .sp-smart-post-list-link`, |
| 196 |
styles: { |
| 197 |
"flex-direction": `${iconPosition === "top" ? "column" : "row"}`, |
| 198 |
}, |
| 199 |
}, |
| 200 |
|
| 201 |
{ |
| 202 |
class: `#${uniqueId} .sp-smart-post-list-icon-wrapper`, |
| 203 |
styles: { |
| 204 |
order: iconPosition !== "top" ? iconPosition : "", |
| 205 |
"align-self": iconAlignment, |
| 206 |
}, |
| 207 |
}, |
| 208 |
|
| 209 |
{ |
| 210 |
class: `#${uniqueId} .sp-smart-post-list-icon-container`, |
| 211 |
styles: { |
| 212 |
background: |
| 213 |
iconBackgroundEnable && |
| 214 |
colorControls(iconBg?.color?.style, iconBg?.color?.solidColor, iconBg?.color?.gradient), |
| 215 |
"border-style": iconBorderStyle.style, |
| 216 |
"border-color": iconBorderStyle.color, |
| 217 |
"clip-path": getClipPathForShape(backgroundShape), |
| 218 |
}, |
| 219 |
}, |
| 220 |
|
| 221 |
{ |
| 222 |
class: `#${uniqueId} .sp-smart-post-list-icon-container:hover`, |
| 223 |
styles: { |
| 224 |
background: |
| 225 |
iconBackgroundEnable && |
| 226 |
colorControls(iconBg?.hover?.style, iconBg?.hover?.solidColor, iconBg?.hover?.gradient), |
| 227 |
"border-style": iconHoverBorderStyle.style, |
| 228 |
"border-color": iconHoverBorderStyle.color, |
| 229 |
}, |
| 230 |
}, |
| 231 |
|
| 232 |
{ |
| 233 |
class: `#${uniqueId} .sp-smart-post-list-icon-svg.iconSet::before `, |
| 234 |
styles: { |
| 235 |
content: svgIconName === "NumberIcon" ? "counter(list-counter)" : '""', |
| 236 |
color: iconColor.color, |
| 237 |
}, |
| 238 |
}, |
| 239 |
|
| 240 |
{ |
| 241 |
class: `#${uniqueId} .sp-smart-post-list-link .sp-smart-post-list-icon-container:hover .sp-smart-post-list-icon-svg::before `, |
| 242 |
|
| 243 |
...(svgIconName !== undefined && { |
| 244 |
styles: { |
| 245 |
color: iconColor.hoverColor, |
| 246 |
}, |
| 247 |
}), |
| 248 |
}, |
| 249 |
|
| 250 |
{ |
| 251 |
class: `#${uniqueId} .sp-smart-post-list-icon-svg svg path`, |
| 252 |
styles: { |
| 253 |
fill: `${iconColor.color} !important`, |
| 254 |
}, |
| 255 |
}, |
| 256 |
|
| 257 |
{ |
| 258 |
class: `#${uniqueId} .sp-smart-post-list-link:hover .sp-smart-post-list-icon-svg svg path`, |
| 259 |
styles: { |
| 260 |
fill: `${iconColor.hoverColor} !important`, |
| 261 |
}, |
| 262 |
}, |
| 263 |
|
| 264 |
{ |
| 265 |
class: `#${uniqueId} .sp-smart-post-list-link .sp-smart-post-list-icon svg `, |
| 266 |
styles: { |
| 267 |
fill: iconColor.color, |
| 268 |
}, |
| 269 |
}, |
| 270 |
|
| 271 |
{ |
| 272 |
class: `#${uniqueId} .sp-smart-post-list-link .sp-smart-post-list-icon:hover svg `, |
| 273 |
styles: { |
| 274 |
fill: iconColor.hoverColor, |
| 275 |
}, |
| 276 |
}, |
| 277 |
|
| 278 |
{ |
| 279 |
class: `#${uniqueId} .sp-smart-post-list-icon-img .sp-smart-post-list-overlay`, |
| 280 |
styles: { |
| 281 |
"background-color": iconColor.color, |
| 282 |
"border-radius": backgroundShape !== "backgroundShapeSquare" ? "50%" : "", |
| 283 |
}, |
| 284 |
}, |
| 285 |
|
| 286 |
{ |
| 287 |
class: `#${uniqueId} .sp-smart-post-list-icon-img:hover .sp-smart-post-list-overlay`, |
| 288 |
styles: { |
| 289 |
"background-color": iconColor.hoverColor, |
| 290 |
}, |
| 291 |
}, |
| 292 |
{ |
| 293 |
class: `#${uniqueId} .sp-smart-post-list-icon-img img`, |
| 294 |
styles: { |
| 295 |
"border-radius": backgroundShape !== "backgroundShapeSquare" ? "50%" : "", |
| 296 |
}, |
| 297 |
}, |
| 298 |
]; |
| 299 |
}; |
| 300 |
|
| 301 |
const contentCSS = () => { |
| 302 |
return [ |
| 303 |
{ |
| 304 |
class: `#${uniqueId} .sp-smart-post-list-title`, |
| 305 |
styles: { |
| 306 |
color: titleColor.color, |
| 307 |
...typographyCss(titleTypography), |
| 308 |
}, |
| 309 |
}, |
| 310 |
{ |
| 311 |
class: `#${uniqueId} .sp-smart-post-list-link:hover .sp-smart-post-list-title`, |
| 312 |
styles: { |
| 313 |
color: titleColor.hoverColor, |
| 314 |
}, |
| 315 |
}, |
| 316 |
{ |
| 317 |
class: `#${uniqueId} .sp-smart-post-list-description`, |
| 318 |
|
| 319 |
styles: { |
| 320 |
color: descriptionColor.color, |
| 321 |
...typographyCss(descriptionTypography), |
| 322 |
}, |
| 323 |
}, |
| 324 |
|
| 325 |
{ |
| 326 |
class: `#${uniqueId} .sp-smart-post-list-link:hover .sp-smart-post-list-description`, |
| 327 |
styles: { |
| 328 |
color: descriptionColor.hoverColor, |
| 329 |
}, |
| 330 |
}, |
| 331 |
]; |
| 332 |
}; |
| 333 |
|
| 334 |
const responsiveCss = (deviceType) => { |
| 335 |
return [ |
| 336 |
{ |
| 337 |
class: `#${uniqueId} .sp-smart-post-smart-list-wrapper`, |
| 338 |
styles: { |
| 339 |
"margin-bottom": |
| 340 |
listOrientation === "vertical" ? `calc(${rangerCss(spaceBetweenLists, deviceType)} / 2)` : "", |
| 341 |
"padding-bottom": |
| 342 |
listOrientation === "vertical" ? `calc(${rangerCss(spaceBetweenLists, deviceType)} / 2)` : "", |
| 343 |
"margin-right": |
| 344 |
listOrientation === "horizontal" ? `calc(${rangerCss(spaceBetweenLists, deviceType)} / 2)` : "", |
| 345 |
"padding-right": |
| 346 |
listOrientation === "horizontal" ? `calc(${rangerCss(spaceBetweenLists, deviceType)} / 2)` : "", |
| 347 |
}, |
| 348 |
}, |
| 349 |
|
| 350 |
// { |
| 351 |
// class: `#${uniqueId} .wp-block-sp-smart-post-show-smart-list:last-child.wp-block-sp-smart-post-show-smart-list |
| 352 |
// .sp-smart-post-smart-list-wrapper `, |
| 353 |
// styles: { |
| 354 |
// "margin-bottom": "0px !important", |
| 355 |
// "padding-bottom": "0px !important", |
| 356 |
// "margin-right": "0px !important", |
| 357 |
// "padding-right": "0px !important", |
| 358 |
// }, |
| 359 |
// }, |
| 360 |
|
| 361 |
{ |
| 362 |
class: `#${uniqueId} .sp-smart-post-list-link`, |
| 363 |
styles: { |
| 364 |
gap: rangerCss(iconContentGap, deviceType), |
| 365 |
}, |
| 366 |
}, |
| 367 |
|
| 368 |
{ |
| 369 |
class: `#${uniqueId}.divider.sp-list-orientation-horizontal .wp-block-sp-smart-post-show-smart-list.sp-list-divider .sp-smart-post-smart-list-wrapper`, |
| 370 |
styles: { |
| 371 |
"border-right-width": rangerCss(dividerWidth, deviceType), |
| 372 |
}, |
| 373 |
}, |
| 374 |
{ |
| 375 |
class: `#${uniqueId}.divider.sp-list-orientation-vertical .wp-block-sp-smart-post-show-smart-list .sp-smart-post-smart-list-wrapper`, |
| 376 |
styles: { |
| 377 |
"border-bottom-width": rangerCss(dividerWidth, deviceType), |
| 378 |
}, |
| 379 |
}, |
| 380 |
|
| 381 |
{ |
| 382 |
class: `#${uniqueId}.divider .wp-block-sp-smart-post-show-smart-list:last-child.wp-block-sp-smart-post-show-smart-list .sp-smart-post-smart-list-wrapper`, |
| 383 |
styles: { |
| 384 |
border: "none !important", |
| 385 |
}, |
| 386 |
}, |
| 387 |
|
| 388 |
{ |
| 389 |
class: `#${uniqueId}.sp-smart-post-smart-lists-wrapper`, |
| 390 |
styles: { |
| 391 |
"border-width": spacingGenerate(borderStyleWidth, deviceType), |
| 392 |
padding: spacingGenerate(padding, deviceType), |
| 393 |
margin: spacingGenerate(margin, deviceType), |
| 394 |
"border-radius": spacingGenerate(borderRadius, deviceType), |
| 395 |
"box-shadow": boxCss(boxShadowEnable, deviceType, boxShadow, "color"), |
| 396 |
}, |
| 397 |
}, |
| 398 |
|
| 399 |
{ |
| 400 |
class: `#${uniqueId}.sp-smart-post-smart-lists-wrapper:hover`, |
| 401 |
styles: { |
| 402 |
"border-width": spacingGenerate(borderHoverStyleWidth, deviceType), |
| 403 |
"border-radius": spacingGenerate(borderHoverRadius, deviceType), |
| 404 |
"box-shadow": boxCss(boxShadowHoverEnable, deviceType, boxShadowHover, "color"), |
| 405 |
}, |
| 406 |
}, |
| 407 |
|
| 408 |
// Icon style |
| 409 |
|
| 410 |
{ |
| 411 |
class: `#${uniqueId} .sp-smart-post-list-icon-container`, |
| 412 |
styles: { |
| 413 |
padding: spacingGenerate(iconPadding, deviceType), |
| 414 |
"border-radius": `${ |
| 415 |
backgroundShape === "backgroundShapeSquare" |
| 416 |
? spacingGenerate(iconBorderRadius, deviceType) |
| 417 |
: "50%" |
| 418 |
}`, |
| 419 |
|
| 420 |
"border-width": spacingGenerate(iconBorderStyleWidth, deviceType), |
| 421 |
}, |
| 422 |
}, |
| 423 |
|
| 424 |
{ |
| 425 |
class: `#${uniqueId} .sp-smart-post-list-icon-container:hover`, |
| 426 |
styles: { |
| 427 |
"border-radius": `${ |
| 428 |
backgroundShape === "backgroundShapeSquare" |
| 429 |
? spacingGenerate(iconHoverBorderRadius, deviceType) |
| 430 |
: "50%" |
| 431 |
}`, |
| 432 |
"border-width": spacingGenerate(iconHoverBorderStyleWidth, deviceType), |
| 433 |
}, |
| 434 |
}, |
| 435 |
|
| 436 |
{ |
| 437 |
class: `#${uniqueId} .sp-smart-post-list-icon-container .sp-smart-post-list-icon-svg svg`, |
| 438 |
styles: { |
| 439 |
width: rangerCss(iconSize, deviceType), |
| 440 |
height: rangerCss(iconSize, deviceType), |
| 441 |
}, |
| 442 |
}, |
| 443 |
|
| 444 |
{ |
| 445 |
class: `#${uniqueId} .sp-smart-post-list-icon-container .sp-smart-post-list-icon`, |
| 446 |
styles: { |
| 447 |
width: rangerCss(iconSize, deviceType), |
| 448 |
height: rangerCss(iconSize, deviceType), |
| 449 |
}, |
| 450 |
}, |
| 451 |
|
| 452 |
{ |
| 453 |
class: `#${uniqueId} .sp-smart-post-list-icon-img img`, |
| 454 |
styles: { |
| 455 |
width: rangerCss(iconCustomWidth, deviceType), |
| 456 |
height: rangerCss(iconCustomHeight, deviceType), |
| 457 |
}, |
| 458 |
}, |
| 459 |
|
| 460 |
{ |
| 461 |
class: `#${uniqueId} .block-editor-block-list__layout .sp-smart-post-list-wrapper`, |
| 462 |
styles: { |
| 463 |
"margin-bottom": |
| 464 |
listOrientation === "vertical" ? `calc(${rangerCss(spaceBetweenLists, deviceType)} / 2)` : "", |
| 465 |
"padding-bottom": |
| 466 |
listOrientation === "vertical" ? `calc(${rangerCss(spaceBetweenLists, deviceType)} / 2)` : "", |
| 467 |
"margin-right": |
| 468 |
listOrientation === "horizontal" ? `calc(${rangerCss(spaceBetweenLists, deviceType)} / 2)` : "", |
| 469 |
"padding-right": |
| 470 |
listOrientation === "horizontal" ? `calc(${rangerCss(spaceBetweenLists, deviceType)} / 2)` : "", |
| 471 |
}, |
| 472 |
}, |
| 473 |
|
| 474 |
{ |
| 475 |
class: `#${uniqueId}.divider .wp-block-sp-smart-post-show-smart-list:last-child.wp-block-sp-smart-post-show-smart-list .sp-smart-post-list-wrapper`, |
| 476 |
styles: { |
| 477 |
border: "none !important", |
| 478 |
}, |
| 479 |
}, |
| 480 |
|
| 481 |
// Content Dynamic Style |
| 482 |
|
| 483 |
{ |
| 484 |
class: `#${uniqueId} .sp-smart-post-list-text`, |
| 485 |
styles: { |
| 486 |
gap: rangerCss(titleDescriptionGap, deviceType), |
| 487 |
"text-align": contentAlignment, |
| 488 |
}, |
| 489 |
}, |
| 490 |
{ |
| 491 |
class: `#${uniqueId} .sp-smart-post-list-title-wrapper`, |
| 492 |
styles: { |
| 493 |
gap: rangerCss(titleDescriptionGap, deviceType), |
| 494 |
"justify-content": contentAlignment, |
| 495 |
}, |
| 496 |
}, |
| 497 |
|
| 498 |
{ |
| 499 |
class: `#${uniqueId} .sp-smart-post-list-title`, |
| 500 |
styles: { |
| 501 |
"font-size": rangerCss(titleFontSize, deviceType), |
| 502 |
"line-height": rangerCss(titleLineHeight, deviceType), |
| 503 |
"letter-spacing": rangerCss(titleLatterSpacing, deviceType), |
| 504 |
"word-spacing": rangerCss(titleWordSpacing, deviceType), |
| 505 |
}, |
| 506 |
}, |
| 507 |
|
| 508 |
{ |
| 509 |
class: `#${uniqueId} .sp-smart-post-list-description`, |
| 510 |
styles: { |
| 511 |
"font-size": rangerCss(descriptionFontSize, deviceType), |
| 512 |
"line-height": rangerCss(descriptionLineHeight, deviceType), |
| 513 |
"letter-spacing": rangerCss(descriptionLatterSpacing, deviceType), |
| 514 |
"word-spacing": rangerCss(descriptionWordSpacing, deviceType), |
| 515 |
}, |
| 516 |
}, |
| 517 |
|
| 518 |
{ |
| 519 |
class: `#${uniqueId} .sp-smart-post-list-icon-svg::before `, |
| 520 |
styles: { |
| 521 |
"font-size": rangerCss(iconSize, deviceType), |
| 522 |
width: |
| 523 |
iconSource === "iconSet" && svgIconName === "NumberIcon" |
| 524 |
? rangerCss(iconSize, deviceType) |
| 525 |
: "0%", |
| 526 |
height: |
| 527 |
iconSource === "iconSet" && svgIconName === "NumberIcon" |
| 528 |
? rangerCss(iconSize, deviceType) |
| 529 |
: "0%", |
| 530 |
}, |
| 531 |
}, |
| 532 |
|
| 533 |
{ |
| 534 |
class: `#${uniqueId} .wp-block-sp-smart-post-show-smart-list`, |
| 535 |
styles: { |
| 536 |
width: rangerCss(listItemsWidth, deviceType), |
| 537 |
"max-width": "100%", |
| 538 |
}, |
| 539 |
}, |
| 540 |
]; |
| 541 |
}; |
| 542 |
|
| 543 |
const desktopCss = [ |
| 544 |
...responsiveCss("Desktop"), |
| 545 |
...generalCSS(), |
| 546 |
...iconImageCSS(), |
| 547 |
...contentCSS(), |
| 548 |
{ |
| 549 |
class: `#${uniqueId} `, |
| 550 |
styles: { |
| 551 |
display: hideOnDesktop ? "none" : "flex", |
| 552 |
}, |
| 553 |
}, |
| 554 |
]; |
| 555 |
|
| 556 |
// Tablet CSS styles. |
| 557 |
const tabletCss = [ |
| 558 |
...responsiveCss("Tablet"), |
| 559 |
{ |
| 560 |
class: `#${uniqueId} `, |
| 561 |
styles: { |
| 562 |
display: hideOnTablet ? "none" : "flex", |
| 563 |
}, |
| 564 |
}, |
| 565 |
]; |
| 566 |
|
| 567 |
// Mobile CSS styles. |
| 568 |
const mobileCss = [ |
| 569 |
...responsiveCss("Mobile"), |
| 570 |
{ |
| 571 |
class: `#${uniqueId} `, |
| 572 |
styles: { |
| 573 |
display: hideOnMobile ? "none" : "flex", |
| 574 |
}, |
| 575 |
}, |
| 576 |
]; |
| 577 |
|
| 578 |
const tabletMediaQueryCss = wrapInMediaQuery(objectToCssString(tabletCss), "only screen and (max-width: 1023px)"); |
| 579 |
const mobileMediaQueryCss = wrapInMediaQuery(objectToCssString(mobileCss), "only screen and (max-width: 599px)"); |
| 580 |
return `${objectToCssString(desktopCss)} ${tabletMediaQueryCss} ${mobileMediaQueryCss}`; |
| 581 |
}; |
| 582 |
|
| 583 |
export default dynamicCss; |
| 584 |
|