| 1 |
import { objectToCssString, rangerCss, spacingGenerate, wrapInMediaQuery } from "../shared/helpFn"; |
| 2 |
|
| 3 |
const cacheCss = { desktop: "", mobile: "", tablet: "" }; |
| 4 |
const dynamicCss = (attributes, currentDevice = "all") => { |
| 5 |
const { |
| 6 |
uniqueId, |
| 7 |
sectionHeadingTypography, |
| 8 |
sectionHeadingFontSize, |
| 9 |
sectionHeadingAliment, |
| 10 |
sectionHeadingColor, |
| 11 |
sectionHeadingFontSpacing, |
| 12 |
sectionHeadingLineHeight, |
| 13 |
sectionHeadingMargin, |
| 14 |
sectionHeadingBorderRadius, |
| 15 |
sectionHeadingPadding, |
| 16 |
sectionHeadingStyleBackgroundColor, |
| 17 |
showSubHeading, |
| 18 |
sectionHeadingStyle, |
| 19 |
sectionSubHeadingTypography, |
| 20 |
sectionSubHeadingFontSize, |
| 21 |
sectionSubHeadingColor, |
| 22 |
sectionSubHeadingFontSpacing, |
| 23 |
sectionSubHeadingLineHeight, |
| 24 |
sectionSubHeadingMargin, |
| 25 |
sectionSubHeadingAliment, |
| 26 |
sectionHeadingWordSpacing, |
| 27 |
hideOnDesktop, |
| 28 |
hideOnTablet, |
| 29 |
hideOnMobile, |
| 30 |
globalBreakPointData, |
| 31 |
headingLineThickness, |
| 32 |
} = attributes; |
| 33 |
|
| 34 |
const getTypographyStyles = ({ |
| 35 |
typography, |
| 36 |
fontSize, |
| 37 |
fontSpacing, |
| 38 |
lineHeight, |
| 39 |
wordSpacing, |
| 40 |
device = "Desktop", |
| 41 |
}) => { |
| 42 |
const { family, fontWeight, decoration, transform, style } = typography; |
| 43 |
|
| 44 |
const typographyStyles = { |
| 45 |
"font-family": family, |
| 46 |
"font-weight": fontWeight, |
| 47 |
"text-decoration": decoration, |
| 48 |
"text-transform": transform, |
| 49 |
"font-style": style, |
| 50 |
}; |
| 51 |
|
| 52 |
const fontStyles = {}; |
| 53 |
const styleProperties = [ |
| 54 |
{ key: "font-size", source: fontSize }, |
| 55 |
{ key: "letter-spacing", source: fontSpacing }, |
| 56 |
{ key: "word-spacing", source: wordSpacing }, |
| 57 |
]; |
| 58 |
styleProperties.forEach(({ key, source }) => { |
| 59 |
if (source?.device?.[device]) { |
| 60 |
fontStyles[key] = source.device?.[device] + source.unit?.[device]; |
| 61 |
} |
| 62 |
}); |
| 63 |
fontStyles["line-height"] = lineHeight?.device?.[device]; |
| 64 |
return device === "Desktop" ? { ...typographyStyles, ...fontStyles } : fontStyles; |
| 65 |
}; |
| 66 |
|
| 67 |
let desktopCss = [ |
| 68 |
{ |
| 69 |
class: `#${uniqueId}.sp-section-heading-wrapper`, |
| 70 |
styles: { |
| 71 |
"text-align": sectionHeadingAliment, |
| 72 |
margin: spacingGenerate(sectionHeadingMargin, "Desktop"), |
| 73 |
}, |
| 74 |
}, |
| 75 |
{ |
| 76 |
class: `#${uniqueId}.sp-section-heading-wrapper .sp-section-heading-container:not(.section-heading-seventeen,.section-heading-eightTeen,.section-heading-twenty) .section-heading-tag`, |
| 77 |
styles: { |
| 78 |
"border-radius": `${sectionHeadingBorderRadius.value}${sectionHeadingBorderRadius.unit}`, |
| 79 |
padding: !["section-heading-five", "section-heading-fourteen"].includes(sectionHeadingStyle) |
| 80 |
? spacingGenerate(sectionHeadingPadding, "Desktop") |
| 81 |
: "", |
| 82 |
}, |
| 83 |
}, |
| 84 |
{ |
| 85 |
class: `#${uniqueId}.sp-section-heading-wrapper .sp-section-heading-container:is(.section-heading-seventeen,.section-heading-eightTeen,.section-heading-twenty) .section-heading-tag .sp-heading-text`, |
| 86 |
styles: { |
| 87 |
"border-radius": `${sectionHeadingBorderRadius.value}${sectionHeadingBorderRadius.unit}`, |
| 88 |
padding: !["section-heading-five", "section-heading-fourteen"].includes(sectionHeadingStyle) |
| 89 |
? spacingGenerate(sectionHeadingPadding, "Desktop") |
| 90 |
: "", |
| 91 |
}, |
| 92 |
}, |
| 93 |
{ |
| 94 |
class: `#${uniqueId}.sp-section-heading-wrapper .sp-section-heading-container .section-heading-tag h2, #${uniqueId}.sp-section-heading-wrapper .sp-section-heading-container .section-heading-tag .sp-heading-text`, |
| 95 |
styles: { |
| 96 |
...getTypographyStyles({ |
| 97 |
typography: sectionHeadingTypography.typography, |
| 98 |
fontSize: sectionHeadingFontSize, |
| 99 |
fontSpacing: sectionHeadingFontSpacing, |
| 100 |
lineHeight: sectionHeadingLineHeight, |
| 101 |
wordSpacing: sectionHeadingWordSpacing, |
| 102 |
}), |
| 103 |
color: sectionHeadingColor.color, |
| 104 |
}, |
| 105 |
}, |
| 106 |
// section heading two style |
| 107 |
{ |
| 108 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-two .section-heading-tag`, |
| 109 |
styles: { |
| 110 |
"background-color": `${sectionHeadingStyleBackgroundColor.color}`, |
| 111 |
}, |
| 112 |
}, |
| 113 |
// section heading three style |
| 114 |
{ |
| 115 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-three .section-heading-tag`, |
| 116 |
styles: { |
| 117 |
"border-left": `${rangerCss( headingLineThickness, "Desktop" )} solid ${sectionHeadingStyleBackgroundColor.color}`, |
| 118 |
display: "inline-block", |
| 119 |
}, |
| 120 |
}, |
| 121 |
// section heading four style |
| 122 |
{ |
| 123 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-four .section-heading-tag .sp-heading-text`, |
| 124 |
styles: { |
| 125 |
"border-bottom": `${rangerCss( headingLineThickness, "Desktop" )} solid ${sectionHeadingStyleBackgroundColor.color}`, |
| 126 |
}, |
| 127 |
}, |
| 128 |
// section heading five style |
| 129 |
{ |
| 130 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-five .section-heading-tag .sp-heading-text, #${uniqueId} .sp-section-heading-container.section-heading-fourteen .section-heading-tag .sp-heading-text`, |
| 131 |
styles: { |
| 132 |
"background-color": sectionHeadingStyleBackgroundColor.color, |
| 133 |
padding: spacingGenerate(sectionHeadingPadding, "Desktop"), |
| 134 |
display: "inline-block", |
| 135 |
"border-radius": `${sectionHeadingBorderRadius.value}${sectionHeadingBorderRadius.unit}`, |
| 136 |
}, |
| 137 |
}, |
| 138 |
{ |
| 139 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-five .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-six .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-seven .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-eight .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-nine .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-nine .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-ten .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-thirteen .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-thirteen .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-fourteen .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-fifteen .section-heading-tag .sp-heading-text::before`, |
| 140 |
styles: { |
| 141 |
height: `${rangerCss( headingLineThickness, "Desktop" )}`, |
| 142 |
"background-color": `${sectionHeadingStyleBackgroundColor.color}`, |
| 143 |
}, |
| 144 |
}, |
| 145 |
{ |
| 146 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyThree .section-heading-tag::after`, |
| 147 |
styles: { |
| 148 |
"border-top-color": `${sectionHeadingStyleBackgroundColor.color}`, |
| 149 |
}, |
| 150 |
}, |
| 151 |
{ |
| 152 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-five .section-heading-tag::after`, |
| 153 |
styles: { |
| 154 |
bottom: "0px", |
| 155 |
}, |
| 156 |
}, |
| 157 |
{ |
| 158 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-eleven .section-heading-tag, #${uniqueId} .sp-section-heading-container.section-heading-twelve .section-heading-tag`, |
| 159 |
styles: { |
| 160 |
"background-color": sectionHeadingStyleBackgroundColor.color, |
| 161 |
}, |
| 162 |
}, |
| 163 |
//sixteen |
| 164 |
{ |
| 165 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-sixteen .section-heading-tag::after`, |
| 166 |
styles: { |
| 167 |
height: `${rangerCss( headingLineThickness, "Desktop" )}`, |
| 168 |
background: `linear-gradient(to right, ${sectionHeadingStyleBackgroundColor.color} 80px, color-mix(in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%) 10px 100px);`, |
| 169 |
}, |
| 170 |
}, |
| 171 |
/// section heading nineteen |
| 172 |
{ |
| 173 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-nineteen .section-heading-tag .sp-heading-text svg`, |
| 174 |
styles: { |
| 175 |
height: `calc(${rangerCss( headingLineThickness, "Desktop" )} * 3)`, |
| 176 |
} |
| 177 |
}, |
| 178 |
//seventeen, eighteen and twenty |
| 179 |
{ |
| 180 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-seventeen .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-eightTeen .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-twenty .section-heading-tag .sp-heading-text::after`, |
| 181 |
styles: { |
| 182 |
height: `${rangerCss( headingLineThickness, "Desktop" )}`, |
| 183 |
background: `linear-gradient(to right, color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%) 0%, color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%) 20%, ${sectionHeadingStyleBackgroundColor.color} 20%, ${sectionHeadingStyleBackgroundColor.color} 80%, color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%) 80%, color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%) 100%);`, |
| 184 |
}, |
| 185 |
}, |
| 186 |
{ |
| 187 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-eightTeen .section-heading-tag .sp-heading-text::after`, |
| 188 |
styles: { |
| 189 |
height: `${rangerCss( headingLineThickness, "Desktop" )}`, |
| 190 |
background: `linear-gradient(to right, ${sectionHeadingStyleBackgroundColor.color} 50%, color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%) 20%, ${sectionHeadingStyleBackgroundColor.color} 20%, ${sectionHeadingStyleBackgroundColor.color} 0%, color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%) 0%, color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%) 20%);`, |
| 191 |
}, |
| 192 |
}, |
| 193 |
// twenty one |
| 194 |
{ |
| 195 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag .sp-heading-text::before, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag::after`, |
| 196 |
styles: { |
| 197 |
height: `${rangerCss( headingLineThickness, "Desktop" )}`, |
| 198 |
"background-color": sectionHeadingStyleBackgroundColor.color, |
| 199 |
}, |
| 200 |
}, |
| 201 |
// twenty two |
| 202 |
{ |
| 203 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyTwo .section-heading-tag`, |
| 204 |
styles: { |
| 205 |
"border-top-color": `color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%)`, |
| 206 |
"border-right-color": `color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%)`, |
| 207 |
"border-bottom-color": `color-mix( in srgb, ${sectionHeadingStyleBackgroundColor.color}, transparent 50%)`, |
| 208 |
"border-left-color": sectionHeadingStyleBackgroundColor.color, |
| 209 |
"border-top-width": `calc(${rangerCss( headingLineThickness, "Desktop" )} / 2)`, |
| 210 |
"border-right-width": `calc(${rangerCss( headingLineThickness, "Desktop" )} / 2)`, |
| 211 |
"border-bottom-width": `calc(${rangerCss( headingLineThickness, "Desktop" )} / 2)`, |
| 212 |
"border-left-width": `${rangerCss( headingLineThickness, "Desktop" )}`, |
| 213 |
}, |
| 214 |
}, |
| 215 |
// twenty three |
| 216 |
{ |
| 217 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyThree .section-heading-tag`, |
| 218 |
styles: { |
| 219 |
"background-color": sectionHeadingStyleBackgroundColor.color, |
| 220 |
"border-radius": `${sectionHeadingBorderRadius.value}${sectionHeadingBorderRadius.unit}`, |
| 221 |
position: "relative", |
| 222 |
}, |
| 223 |
}, |
| 224 |
// twenty four |
| 225 |
{ |
| 226 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyFour .section-heading-tag`, |
| 227 |
styles: { |
| 228 |
"border-radius": `${sectionHeadingBorderRadius.value}${sectionHeadingBorderRadius.unit}`, |
| 229 |
"background-color": sectionHeadingStyleBackgroundColor.color, |
| 230 |
}, |
| 231 |
}, |
| 232 |
...(hideOnDesktop |
| 233 |
? [ |
| 234 |
{ |
| 235 |
class: `#${uniqueId}`, |
| 236 |
styles: { |
| 237 |
display: "none", |
| 238 |
}, |
| 239 |
}, |
| 240 |
] |
| 241 |
: []), |
| 242 |
]; |
| 243 |
|
| 244 |
/* sub heading desktop css */ |
| 245 |
if (showSubHeading) { |
| 246 |
desktopCss = [ |
| 247 |
...desktopCss, |
| 248 |
{ |
| 249 |
class: `#${uniqueId} .sp-section-subheading-container`, |
| 250 |
styles: { |
| 251 |
margin: spacingGenerate(sectionSubHeadingMargin, "Desktop"), |
| 252 |
}, |
| 253 |
}, |
| 254 |
{ |
| 255 |
class: `#${uniqueId} .sp-section-subheading-container .sp-subheading-text`, |
| 256 |
styles: { |
| 257 |
...getTypographyStyles({ |
| 258 |
typography: sectionSubHeadingTypography.typography, |
| 259 |
fontSize: sectionSubHeadingFontSize, |
| 260 |
fontSpacing: sectionSubHeadingFontSpacing, |
| 261 |
lineHeight: sectionSubHeadingLineHeight, |
| 262 |
}), |
| 263 |
color: sectionSubHeadingColor.color, |
| 264 |
"text-align": sectionSubHeadingAliment, |
| 265 |
}, |
| 266 |
}, |
| 267 |
]; |
| 268 |
} |
| 269 |
|
| 270 |
cacheCss.desktop = objectToCssString(desktopCss); |
| 271 |
|
| 272 |
if ("Tablet" === currentDevice || "all" === currentDevice) { |
| 273 |
// Tablet CSS styles. |
| 274 |
let tabletCss = [ |
| 275 |
{ |
| 276 |
class: `#${uniqueId}.sp-section-heading-wrapper |
| 277 |
.sp-section-heading-container`, |
| 278 |
styles: { |
| 279 |
margin: spacingGenerate(sectionHeadingMargin, "Tablet"), |
| 280 |
}, |
| 281 |
}, |
| 282 |
{ |
| 283 |
class: `#${uniqueId}.sp-section-heading-wrapper .sp-section-heading-container .section-heading-tag h2, |
| 284 |
#${uniqueId}.sp-section-heading-wrapper .sp-section-heading-container .section-heading-tag .sp-heading-text`, |
| 285 |
styles: { |
| 286 |
...getTypographyStyles({ |
| 287 |
typography: sectionHeadingTypography.typography, |
| 288 |
fontSize: sectionHeadingFontSize, |
| 289 |
fontSpacing: sectionHeadingFontSpacing, |
| 290 |
lineHeight: sectionHeadingLineHeight, |
| 291 |
device: "Tablet", |
| 292 |
}), |
| 293 |
padding: spacingGenerate(sectionHeadingPadding, "Tablet"), |
| 294 |
}, |
| 295 |
}, |
| 296 |
// section heading three style |
| 297 |
{ |
| 298 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-three .section-heading-tag`, |
| 299 |
styles: { |
| 300 |
"border-left": `${rangerCss( headingLineThickness, "Tablet" )} solid ${sectionHeadingStyleBackgroundColor.color}`, |
| 301 |
}, |
| 302 |
}, |
| 303 |
// section heading four style |
| 304 |
{ |
| 305 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-four .section-heading-tag .sp-heading-text`, |
| 306 |
styles: { |
| 307 |
"border-bottom": `${rangerCss( headingLineThickness, "Tablet" )} solid ${sectionHeadingStyleBackgroundColor.color}`, |
| 308 |
}, |
| 309 |
}, |
| 310 |
{ |
| 311 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-five .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-six .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-seven .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-eight .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-nine .section-heading-tag::after, |
| 312 |
#${uniqueId} .sp-section-heading-container.section-heading-nine .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-ten .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-thirteen .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-thirteen .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-fourteen .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-fifteen .section-heading-tag::before`, |
| 313 |
styles: { |
| 314 |
height: `${rangerCss( headingLineThickness, "Tablet" )}`, |
| 315 |
}, |
| 316 |
}, |
| 317 |
{ |
| 318 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-sixteen .section-heading-tag::after`, |
| 319 |
styles: { |
| 320 |
height: `${rangerCss( headingLineThickness, "Tablet" )}`, |
| 321 |
}, |
| 322 |
}, |
| 323 |
/// section heading nineteen |
| 324 |
//seventeen, eighteen and twenty |
| 325 |
{ |
| 326 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-seventeen .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-eightTeen .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-twenty .section-heading-tag .sp-heading-text::after`, |
| 327 |
styles: { |
| 328 |
height: `${rangerCss( headingLineThickness, "Tablet" )}`, |
| 329 |
}, |
| 330 |
}, |
| 331 |
// TwentyOne |
| 332 |
{ |
| 333 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag .sp-heading-text::before, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag::after`, |
| 334 |
styles: { |
| 335 |
height: `${rangerCss( headingLineThickness, "Tablet" )}`, |
| 336 |
}, |
| 337 |
}, |
| 338 |
// twenty two |
| 339 |
{ |
| 340 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyTwo .section-heading-tag`, |
| 341 |
styles: { |
| 342 |
"border-top-width": `calc(${rangerCss( headingLineThickness, "Tablet" )} / 2)`, |
| 343 |
"border-right-width": `calc(${rangerCss( headingLineThickness, "Tablet" )} / 2)`, |
| 344 |
"border-bottom-width": `calc(${rangerCss( headingLineThickness, "Tablet" )} / 2)`, |
| 345 |
"border-left-width": `${rangerCss( headingLineThickness, "Tablet" )}`, |
| 346 |
}, |
| 347 |
}, |
| 348 |
...(hideOnTablet |
| 349 |
? [ |
| 350 |
{ |
| 351 |
class: `#${uniqueId}`, |
| 352 |
styles: { |
| 353 |
display: "none", |
| 354 |
}, |
| 355 |
}, |
| 356 |
] |
| 357 |
: []), |
| 358 |
]; |
| 359 |
|
| 360 |
/* sub heading tablet css */ |
| 361 |
if (showSubHeading) { |
| 362 |
tabletCss = [ |
| 363 |
...tabletCss, |
| 364 |
{ |
| 365 |
class: `#${uniqueId} .sp-section-subheading-container`, |
| 366 |
styles: { |
| 367 |
margin: spacingGenerate(sectionSubHeadingMargin, "Tablet"), |
| 368 |
}, |
| 369 |
}, |
| 370 |
{ |
| 371 |
class: `#${uniqueId} .sp-section-subheading-container .sp-subheading-text`, |
| 372 |
styles: { |
| 373 |
...getTypographyStyles({ |
| 374 |
typography: sectionSubHeadingTypography.typography, |
| 375 |
fontSize: sectionSubHeadingFontSize, |
| 376 |
fontSpacing: sectionSubHeadingFontSpacing, |
| 377 |
lineHeight: sectionSubHeadingLineHeight, |
| 378 |
device: "Tablet", |
| 379 |
}), |
| 380 |
}, |
| 381 |
}, |
| 382 |
]; |
| 383 |
} |
| 384 |
cacheCss.tablet = wrapInMediaQuery( |
| 385 |
objectToCssString(tabletCss), |
| 386 |
`only screen and (max-width: ${globalBreakPointData?.tablet}px)` |
| 387 |
); |
| 388 |
} |
| 389 |
if ("Mobile" === currentDevice || "all" === currentDevice) { |
| 390 |
// Mobile CSS styles. |
| 391 |
let mobileCss = [ |
| 392 |
{ |
| 393 |
class: `#${uniqueId}.sp-section-heading-wrapper |
| 394 |
.sp-section-heading-container`, |
| 395 |
styles: { |
| 396 |
margin: spacingGenerate(sectionHeadingMargin, "Mobile"), |
| 397 |
}, |
| 398 |
}, |
| 399 |
{ |
| 400 |
class: `#${uniqueId}.sp-section-heading-wrapper .sp-section-heading-container .section-heading-tag h2, |
| 401 |
#${uniqueId}.sp-section-heading-wrapper .sp-section-heading-container .section-heading-tag .sp-heading-text`, |
| 402 |
styles: { |
| 403 |
...getTypographyStyles({ |
| 404 |
typography: sectionHeadingTypography.typography, |
| 405 |
fontSize: sectionHeadingFontSize, |
| 406 |
fontSpacing: sectionHeadingFontSpacing, |
| 407 |
lineHeight: sectionHeadingLineHeight, |
| 408 |
device: "Mobile", |
| 409 |
}), |
| 410 |
padding: spacingGenerate(sectionHeadingPadding, "Mobile"), |
| 411 |
}, |
| 412 |
}, |
| 413 |
// section heading three style |
| 414 |
{ |
| 415 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-three .section-heading-tag`, |
| 416 |
styles: { |
| 417 |
"border-left": `${rangerCss( headingLineThickness, "Mobile" )} solid ${sectionHeadingStyleBackgroundColor.color}`, |
| 418 |
}, |
| 419 |
}, |
| 420 |
// section heading four style |
| 421 |
{ |
| 422 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-four .section-heading-tag .sp-heading-text`, |
| 423 |
styles: { |
| 424 |
"border-bottom": `${rangerCss( headingLineThickness, "Mobile" )} solid ${sectionHeadingStyleBackgroundColor.color}`, |
| 425 |
}, |
| 426 |
}, |
| 427 |
{ |
| 428 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-five .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-six .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-seven .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-eight .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-nine .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-nine .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-ten .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-thirteen .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-thirteen .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-fourteen .section-heading-tag::after, #${uniqueId} .sp-section-heading-container.section-heading-fifteen .section-heading-tag::before`, |
| 429 |
styles: { |
| 430 |
height: `${rangerCss( headingLineThickness, "Mobile" )}`, |
| 431 |
}, |
| 432 |
}, |
| 433 |
{ |
| 434 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-sixteen .section-heading-tag::after`, |
| 435 |
styles: { |
| 436 |
height: `${rangerCss( headingLineThickness, "Mobile" )}`, |
| 437 |
}, |
| 438 |
}, |
| 439 |
/// section heading nineteen |
| 440 |
//seventeen, eighteen and twenty |
| 441 |
{ |
| 442 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-seventeen .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-eightTeen .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-twenty .section-heading-tag .sp-heading-text::after`, |
| 443 |
styles: { |
| 444 |
height: `${rangerCss( headingLineThickness, "Mobile" )}`, |
| 445 |
}, |
| 446 |
}, |
| 447 |
// TwentyOne |
| 448 |
{ |
| 449 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag .sp-heading-text::before, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag::before, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag .sp-heading-text::after, #${uniqueId} .sp-section-heading-container.section-heading-twentyOne .section-heading-tag::after`, |
| 450 |
styles: { |
| 451 |
height: `${rangerCss( headingLineThickness, "Mobile" )}`, |
| 452 |
}, |
| 453 |
}, |
| 454 |
// twenty two |
| 455 |
{ |
| 456 |
class: `#${uniqueId} .sp-section-heading-container.section-heading-twentyTwo .section-heading-tag`, |
| 457 |
styles: { |
| 458 |
"border-top-width": `calc(${rangerCss( headingLineThickness, "Tablet" )} / 2)`, |
| 459 |
"border-right-width": `calc(${rangerCss( headingLineThickness, "Tablet" )} / 2)`, |
| 460 |
"border-bottom-width": `calc(${rangerCss( headingLineThickness, "Tablet" )} / 2)`, |
| 461 |
"border-left-width": `${rangerCss( headingLineThickness, "Tablet" )}`, |
| 462 |
}, |
| 463 |
}, |
| 464 |
|
| 465 |
...(hideOnMobile |
| 466 |
? [ |
| 467 |
{ |
| 468 |
class: `#${uniqueId}`, |
| 469 |
styles: { |
| 470 |
display: "none", |
| 471 |
}, |
| 472 |
}, |
| 473 |
] |
| 474 |
: []), |
| 475 |
]; |
| 476 |
|
| 477 |
/* sub heading tablet css */ |
| 478 |
if (showSubHeading) { |
| 479 |
mobileCss = [ |
| 480 |
...mobileCss, |
| 481 |
{ |
| 482 |
class: `#${uniqueId} .sp-section-subheading-container`, |
| 483 |
styles: { |
| 484 |
margin: spacingGenerate(sectionSubHeadingMargin, "Mobile"), |
| 485 |
}, |
| 486 |
}, |
| 487 |
{ |
| 488 |
class: `#${uniqueId} .sp-section-subheading-container .sp-subheading-text`, |
| 489 |
styles: { |
| 490 |
...getTypographyStyles({ |
| 491 |
typography: sectionSubHeadingTypography.typography, |
| 492 |
fontSize: sectionSubHeadingFontSize, |
| 493 |
fontSpacing: sectionSubHeadingFontSpacing, |
| 494 |
lineHeight: sectionSubHeadingLineHeight, |
| 495 |
device: "Mobile", |
| 496 |
}), |
| 497 |
}, |
| 498 |
}, |
| 499 |
]; |
| 500 |
} |
| 501 |
|
| 502 |
cacheCss.mobile = wrapInMediaQuery( |
| 503 |
objectToCssString(mobileCss), |
| 504 |
`only screen and (max-width: ${globalBreakPointData?.mobile}px)` |
| 505 |
); |
| 506 |
} |
| 507 |
|
| 508 |
return `${cacheCss.desktop} ${cacheCss.tablet} ${cacheCss.mobile}`; |
| 509 |
}; |
| 510 |
|
| 511 |
export default dynamicCss; |