fragment-headless-sdk 2.1.6 → 2.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -33,20 +33,24 @@ export default function CountdownTimer({ content, }) {
|
|
|
33
33
|
const blockClass = mergeSlotClasses("flex flex-col items-center", styling, "countdownBlock");
|
|
34
34
|
const blockStyle = mergeSlotStyles(undefined, styling, "countdownBlock");
|
|
35
35
|
const blockAttributes = mergeSlotAttributes(styling, "countdownBlock");
|
|
36
|
-
const digitClass = mergeSlotClasses("text-white text-xl font-bold flex items-center justify-center leading-none", styling, "countdownDigit");
|
|
36
|
+
const digitClass = mergeSlotClasses("text-white text-xl font-bold flex items-center justify-center leading-none rounded px-1", styling, "countdownDigit");
|
|
37
37
|
const digitTextColor = resolveToken(styling, "counterDigitColor", "#FFFFFF") || "#FFFFFF";
|
|
38
|
+
const digitBackgroundColor = resolveToken(styling, "counterDigitBackgroundColor", "#000000") ||
|
|
39
|
+
"#000000";
|
|
40
|
+
const counterTextColor = resolveToken(styling, "counterTextColor", digitTextColor);
|
|
38
41
|
const digitStyle = mergeSlotStyles({
|
|
39
42
|
color: digitTextColor,
|
|
43
|
+
backgroundColor: digitBackgroundColor,
|
|
40
44
|
}, styling, "countdownDigit");
|
|
41
45
|
const digitAttributes = mergeSlotAttributes(styling, "countdownDigit");
|
|
42
46
|
const labelClass = mergeSlotClasses("mt-0.5 text-[10px] leading-tight", styling, "countdownLabel");
|
|
43
47
|
const labelStyle = mergeSlotStyles({
|
|
44
|
-
color:
|
|
48
|
+
color: counterTextColor,
|
|
45
49
|
}, styling, "countdownLabel");
|
|
46
50
|
const labelAttributes = mergeSlotAttributes(styling, "countdownLabel");
|
|
47
51
|
const separatorClass = mergeSlotClasses("text-xl font-semibold -mt-4", styling, "countdownSeparator");
|
|
48
52
|
const separatorStyle = mergeSlotStyles({
|
|
49
|
-
color:
|
|
53
|
+
color: counterTextColor,
|
|
50
54
|
}, styling, "countdownSeparator");
|
|
51
55
|
const separatorAttributes = mergeSlotAttributes(styling, "countdownSeparator");
|
|
52
56
|
const renderBlock = (value, label) => (React.createElement("div", { className: blockClass, style: blockStyle, ...(blockAttributes ?? {}) },
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=Geist+Mono:wght@100..900&family=Roboto:wght@300;400;500;700&family=Open+Sans:wght@300;400;600;700&family=Lato:wght@300;400;700&family=Montserrat:wght@300;400;500;700&family=Inter:wght@300;400;500;700&family=Poppins:wght@300;400;600;700&family=Raleway:wght@300;400;500;700&family=Playfair+Display:wght@400;700&family=Merriweather:wght@300;400;700&family=Oswald:wght@300;400;500;700&display=swap");
|
|
2
|
+
|
|
3
|
+
/* Custom animations for fragment-headless-sdk */
|
|
4
|
+
@keyframes marquee {
|
|
5
|
+
0% {
|
|
6
|
+
transform: translateX(0%);
|
|
7
|
+
}
|
|
8
|
+
100% {
|
|
9
|
+
transform: translateX(-100%);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Utility classes for marquee animations */
|
|
14
|
+
.animate-marquee {
|
|
15
|
+
animation: marquee 25s linear infinite;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Make hero/announcement prose links inherit the surrounding text color (v2.1+) */
|
|
19
|
+
.prose {
|
|
20
|
+
--tw-prose-links: currentColor;
|
|
21
|
+
--tw-prose-links-hover: currentColor;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.prose :where(a):not(:where([class~="not-prose"] *)) {
|
|
25
|
+
color: currentColor;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.prose :where(a):not(:where([class~="not-prose"] *)):hover {
|
|
29
|
+
color: currentColor;
|
|
30
|
+
text-decoration: underline;
|
|
31
|
+
}
|
|
@@ -39,7 +39,7 @@ export function resolveHeroColors(content) {
|
|
|
39
39
|
return {
|
|
40
40
|
title: fallbackColor(tokens.title, DEFAULT_COLORS.title),
|
|
41
41
|
text: fallbackColor(tokens.text, DEFAULT_COLORS.text),
|
|
42
|
-
buttonBackground: fallbackColor(tokens.
|
|
42
|
+
buttonBackground: fallbackColor(tokens.buttonBackground, DEFAULT_COLORS.buttonBackground),
|
|
43
43
|
buttonText: fallbackColor(tokens.buttonText, DEFAULT_COLORS.buttonText),
|
|
44
44
|
background: fallbackColor(tokens.background, DEFAULT_COLORS.background),
|
|
45
45
|
};
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -4,7 +4,7 @@ The official SDK for integrating with Fragment-Shopify CMS. Provides React compo
|
|
|
4
4
|
|
|
5
5
|
## ✨ What's New
|
|
6
6
|
|
|
7
|
-
**v2.1.
|
|
7
|
+
**v2.1.8** - Enhanced countdown timer styling with customizable color tokens
|
|
8
8
|
|
|
9
9
|
> See [CHANGELOG.md](./docs/CHANGELOG.md) for full release history
|
|
10
10
|
|
|
@@ -433,6 +433,44 @@ interface IAnnouncementContent {
|
|
|
433
433
|
- `button` - Action button
|
|
434
434
|
- `closeButton` - Close button
|
|
435
435
|
- `countdown` - Countdown container (countdown type)
|
|
436
|
+
- `countdownContainer` - Countdown timer container
|
|
437
|
+
- `countdownBlock` - Individual time block (days, hours, etc.)
|
|
438
|
+
- `countdownDigit` - Countdown digit styling
|
|
439
|
+
- `countdownLabel` - Time unit labels (Days, Hours, Mins, Secs)
|
|
440
|
+
- `countdownSeparator` - Separator between time blocks (`:`)
|
|
441
|
+
|
|
442
|
+
**Countdown Timer Color Tokens:**
|
|
443
|
+
|
|
444
|
+
For countdown-type announcements, you can customize the timer appearance using these color tokens in `styling.tokens.colors`:
|
|
445
|
+
|
|
446
|
+
- `counterDigitColor` - Color of the countdown digits (default: `#FFFFFF`)
|
|
447
|
+
- `counterDigitBackgroundColor` - Background color of the countdown digits (default: `#000000`)
|
|
448
|
+
- `counterTextColor` - Color of labels and separators (default: uses `counterDigitColor`)
|
|
449
|
+
|
|
450
|
+
**Example:**
|
|
451
|
+
|
|
452
|
+
```tsx
|
|
453
|
+
const announcementContent = {
|
|
454
|
+
buttonType: ButtonType.Default,
|
|
455
|
+
buttonText: "Shop now",
|
|
456
|
+
buttonLink: "/",
|
|
457
|
+
counterEndDate: "2026-01-01T17:00:00.000Z",
|
|
458
|
+
announcementHtml: "🎉 Check out the latest products!",
|
|
459
|
+
styling: {
|
|
460
|
+
tokens: {
|
|
461
|
+
colors: {
|
|
462
|
+
text: "#1e293b",
|
|
463
|
+
background: "#e0e7ff",
|
|
464
|
+
button: "#4f46e5",
|
|
465
|
+
buttonText: "#ffffff",
|
|
466
|
+
counterDigitColor: "#ffffff",
|
|
467
|
+
counterDigitBackgroundColor: "#4f46e5",
|
|
468
|
+
counterTextColor: "#000000",
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
};
|
|
473
|
+
```
|
|
436
474
|
|
|
437
475
|
## 🔑 API Key Setup
|
|
438
476
|
|