@anubis609/astroanimate-core 0.1.2
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.
- package/LICENSE +21 -0
- package/README.md +212 -0
- package/dist/components/AnimatedBorderButton/AnimatedBorderButton.astro +129 -0
- package/dist/components/AnimatedBorderButton/index.js +3 -0
- package/dist/components/AnimatedBorderButton/index.js.map +1 -0
- package/dist/components/AnimatedButton/AnimatedButton.astro +299 -0
- package/dist/components/AnimatedButton/index.js +3 -0
- package/dist/components/AnimatedButton/index.js.map +1 -0
- package/dist/components/AnimatedCard/AnimatedCard.astro +832 -0
- package/dist/components/AnimatedCard/index.js +3 -0
- package/dist/components/AnimatedCard/index.js.map +1 -0
- package/dist/components/AnimatedTabs/AnimatedTabs.astro +348 -0
- package/dist/components/AnimatedTabs/index.js +3 -0
- package/dist/components/AnimatedTabs/index.js.map +1 -0
- package/dist/components/ArrowCTAButton/ArrowCTAButton.astro +159 -0
- package/dist/components/ArticleCard/ArticleCard.astro +208 -0
- package/dist/components/CardStack/CardStack.astro +444 -0
- package/dist/components/CardStack/index.js +3 -0
- package/dist/components/CardStack/index.js.map +1 -0
- package/dist/components/CountUp/CountUp.astro +89 -0
- package/dist/components/CountUp/index.js +3 -0
- package/dist/components/CountUp/index.js.map +1 -0
- package/dist/components/Dock/Dock.astro +567 -0
- package/dist/components/Dock/DockItem.astro +135 -0
- package/dist/components/Dropdown/Dropdown.astro +264 -0
- package/dist/components/ExpandableCard/ExpandableCard.astro +402 -0
- package/dist/components/ExpandableCard/index.js +3 -0
- package/dist/components/ExpandableCard/index.js.map +1 -0
- package/dist/components/FadeInText/FadeInText.astro +314 -0
- package/dist/components/FadeInText/index.js +3 -0
- package/dist/components/FadeInText/index.js.map +1 -0
- package/dist/components/FillHoverButton/FillHoverButton.astro +125 -0
- package/dist/components/GitHubShineButton/GitHubShineButton.astro +208 -0
- package/dist/components/GlassCard/GlassCard.astro +245 -0
- package/dist/components/GlassCard/index.js +3 -0
- package/dist/components/GlassCard/index.js.map +1 -0
- package/dist/components/GridDotsBackground/GridDotsBackground.astro +144 -0
- package/dist/components/HighlightText/HighlightText.astro +106 -0
- package/dist/components/InfiniteMarquee/InfiniteMarquee.astro +339 -0
- package/dist/components/JobCard/JobCard.astro +230 -0
- package/dist/components/LiquidGlassCard/LiquidGlassCard.astro +569 -0
- package/dist/components/Loader/Loader.astro +156 -0
- package/dist/components/Loader/index.js +3 -0
- package/dist/components/Loader/index.js.map +1 -0
- package/dist/components/NewsletterPopupCard/NewsletterPopupCard.astro +331 -0
- package/dist/components/ProductReviewCard/ProductReviewCard.astro +188 -0
- package/dist/components/ProgressBar/ProgressBar.astro +137 -0
- package/dist/components/ProgressBar/index.js +3 -0
- package/dist/components/ProgressBar/index.js.map +1 -0
- package/dist/components/RevealImage/RevealImage.astro +160 -0
- package/dist/components/RevealImage/index.js +3 -0
- package/dist/components/RevealImage/index.js.map +1 -0
- package/dist/components/ScaleIn/ScaleIn.astro +231 -0
- package/dist/components/ScaleIn/index.js +3 -0
- package/dist/components/ScaleIn/index.js.map +1 -0
- package/dist/components/SlidingOverlayButton/SlidingOverlayButton.astro +126 -0
- package/dist/components/StaggerTextButton/StaggerTextButton.astro +132 -0
- package/dist/components/Tooltip/Tooltip.astro +255 -0
- package/dist/components/Tooltip/index.js +3 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/TypewriterText/TypewriterText.astro +380 -0
- package/dist/components/TypewriterText/index.js +3 -0
- package/dist/components/TypewriterText/index.js.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/countup.js +90 -0
- package/dist/internal/countup.js.map +1 -0
- package/dist/internal/dropdown.js +166 -0
- package/dist/internal/dropdown.js.map +1 -0
- package/dist/internal/fadein.js +116 -0
- package/dist/internal/fadein.js.map +1 -0
- package/dist/internal/guards.js +12 -0
- package/dist/internal/guards.js.map +1 -0
- package/dist/internal/tabs.js +140 -0
- package/dist/internal/tabs.js.map +1 -0
- package/package.json +229 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
submitLabel?: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
actionUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
title = "Subscribe for updates",
|
|
12
|
+
description =
|
|
13
|
+
"Subscribe to this weekly newsletter so you don’t miss out on the latest tech topics.",
|
|
14
|
+
submitLabel = "Subscribe",
|
|
15
|
+
actionUrl = "/api/subscribe",
|
|
16
|
+
class: className = "",
|
|
17
|
+
} = Astro.props;
|
|
18
|
+
|
|
19
|
+
const formId = `newsletter-form-${Math.random().toString(36).slice(2, 10)}`;
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
/* ✅ CRITERION 7: CSS-FIRST */
|
|
24
|
+
|
|
25
|
+
[data-npc],
|
|
26
|
+
[data-npc] * {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-npc] {
|
|
31
|
+
width: min(20rem, 100%);
|
|
32
|
+
|
|
33
|
+
border: 1px solid #eeeeee;
|
|
34
|
+
border-radius: 1rem;
|
|
35
|
+
|
|
36
|
+
background: #ffffff;
|
|
37
|
+
|
|
38
|
+
box-shadow:
|
|
39
|
+
0 10px 30px rgba(0, 0, 0, 0.08);
|
|
40
|
+
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
|
|
43
|
+
font-family:
|
|
44
|
+
Inter,
|
|
45
|
+
-apple-system,
|
|
46
|
+
BlinkMacSystemFont,
|
|
47
|
+
"Segoe UI",
|
|
48
|
+
sans-serif;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.form {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
gap: 1.25rem;
|
|
55
|
+
|
|
56
|
+
padding: 1.5rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.icon-box {
|
|
60
|
+
width: 3.75rem;
|
|
61
|
+
height: 3.75rem;
|
|
62
|
+
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
|
|
67
|
+
border-radius: 0.75rem;
|
|
68
|
+
|
|
69
|
+
background: #ecf1fd;
|
|
70
|
+
|
|
71
|
+
box-shadow:
|
|
72
|
+
0 1px 2px rgba(0,0,0,0.04);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.icon {
|
|
76
|
+
width: 2rem;
|
|
77
|
+
height: 2rem;
|
|
78
|
+
|
|
79
|
+
color: #115dfc;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.content {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
gap: 0.5rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.title {
|
|
89
|
+
margin: 0;
|
|
90
|
+
|
|
91
|
+
color: #2b2b2f;
|
|
92
|
+
|
|
93
|
+
font-size: 1.125rem;
|
|
94
|
+
font-weight: 700;
|
|
95
|
+
line-height: 1.4;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.description {
|
|
99
|
+
margin: 0;
|
|
100
|
+
|
|
101
|
+
color: #5f5d6b;
|
|
102
|
+
|
|
103
|
+
font-size: 0.875rem;
|
|
104
|
+
line-height: 1.5;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.input {
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: 2.9rem;
|
|
110
|
+
|
|
111
|
+
padding-inline: 0.875rem;
|
|
112
|
+
|
|
113
|
+
border: 1px solid #e5e5e5;
|
|
114
|
+
border-radius: 0.6rem;
|
|
115
|
+
|
|
116
|
+
background: #ffffff;
|
|
117
|
+
|
|
118
|
+
font-size: 0.95rem;
|
|
119
|
+
|
|
120
|
+
transition:
|
|
121
|
+
border-color 200ms ease,
|
|
122
|
+
box-shadow 200ms ease;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.input::placeholder {
|
|
126
|
+
color: #6b7280;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.input:focus {
|
|
130
|
+
outline: none;
|
|
131
|
+
|
|
132
|
+
border-color: #115dfc;
|
|
133
|
+
|
|
134
|
+
box-shadow:
|
|
135
|
+
0 0 0 4px rgba(17, 93, 252, 0.1);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* Autofill fix */
|
|
139
|
+
.input:-webkit-autofill,
|
|
140
|
+
.input:-webkit-autofill:hover,
|
|
141
|
+
.input:-webkit-autofill:focus,
|
|
142
|
+
.input:-webkit-autofill:active {
|
|
143
|
+
-webkit-box-shadow:
|
|
144
|
+
0 0 0 1000px #ffffff inset !important;
|
|
145
|
+
|
|
146
|
+
-webkit-text-fill-color:
|
|
147
|
+
#111827 !important;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.submit {
|
|
151
|
+
width: 100%;
|
|
152
|
+
height: 2.9rem;
|
|
153
|
+
|
|
154
|
+
border: none;
|
|
155
|
+
border-radius: 0.6rem;
|
|
156
|
+
|
|
157
|
+
background:
|
|
158
|
+
linear-gradient(
|
|
159
|
+
180deg,
|
|
160
|
+
#4480ff 0%,
|
|
161
|
+
#115dfc 50%,
|
|
162
|
+
#0550ed 100%
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
color: white;
|
|
166
|
+
|
|
167
|
+
font-size: 0.95rem;
|
|
168
|
+
font-weight: 600;
|
|
169
|
+
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
|
|
172
|
+
transition:
|
|
173
|
+
transform 200ms ease,
|
|
174
|
+
opacity 200ms ease;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.submit:hover {
|
|
178
|
+
opacity: 0.96;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.submit:active {
|
|
182
|
+
transform: scale(0.985);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Accessibility */
|
|
186
|
+
.submit:focus-visible,
|
|
187
|
+
.input:focus-visible {
|
|
188
|
+
outline: 2px solid #115dfc;
|
|
189
|
+
outline-offset: 3px;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.sr-only {
|
|
193
|
+
position: absolute;
|
|
194
|
+
width: 1px;
|
|
195
|
+
height: 1px;
|
|
196
|
+
padding: 0;
|
|
197
|
+
margin: -1px;
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
clip: rect(0, 0, 0, 0);
|
|
200
|
+
white-space: nowrap;
|
|
201
|
+
border-width: 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* ✅ CRITERION 6 */
|
|
205
|
+
@media (prefers-reduced-motion: reduce) {
|
|
206
|
+
[data-npc],
|
|
207
|
+
[data-npc] * {
|
|
208
|
+
transition: none !important;
|
|
209
|
+
animation: none !important;
|
|
210
|
+
transform: none !important;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
</style>
|
|
214
|
+
|
|
215
|
+
<div
|
|
216
|
+
data-npc
|
|
217
|
+
class={className}
|
|
218
|
+
>
|
|
219
|
+
<form
|
|
220
|
+
id={formId}
|
|
221
|
+
data-newsletter-form
|
|
222
|
+
class="form"
|
|
223
|
+
action={actionUrl}
|
|
224
|
+
data-action={actionUrl}
|
|
225
|
+
method="post"
|
|
226
|
+
>
|
|
227
|
+
<div
|
|
228
|
+
class="icon-box"
|
|
229
|
+
aria-hidden="true"
|
|
230
|
+
>
|
|
231
|
+
<svg
|
|
232
|
+
class="icon"
|
|
233
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
234
|
+
fill="none"
|
|
235
|
+
viewBox="0 0 34 34"
|
|
236
|
+
>
|
|
237
|
+
<path
|
|
238
|
+
stroke-linejoin="round"
|
|
239
|
+
stroke-width="2.5"
|
|
240
|
+
stroke="currentColor"
|
|
241
|
+
d="M7.08385 9.91666L5.3572 11.0677C4.11945 11.8929 3.50056 12.3055 3.16517 12.9347C2.82977 13.564 2.83226 14.3035 2.83722 15.7825C2.84322 17.5631 2.85976 19.3774 2.90559 21.2133C3.01431 25.569 3.06868 27.7468 4.67008 29.3482C6.27148 30.9498 8.47873 31.0049 12.8932 31.1152C15.6396 31.1838 18.3616 31.1838 21.1078 31.1152C25.5224 31.0049 27.7296 30.9498 29.331 29.3482C30.9324 27.7468 30.9868 25.569 31.0954 21.2133C31.1413 19.3774 31.1578 17.5631 31.1639 15.7825C31.1688 14.3035 31.1712 13.564 30.8359 12.9347C30.5004 12.3055 29.8816 11.8929 28.6437 11.0677L26.9171 9.91666"
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
<path
|
|
245
|
+
stroke-linejoin="round"
|
|
246
|
+
stroke-width="2.5"
|
|
247
|
+
stroke="currentColor"
|
|
248
|
+
d="M2.83331 14.1667L12.6268 20.0427C14.7574 21.3211 15.8227 21.9603 17 21.9603C18.1772 21.9603 19.2426 21.3211 21.3732 20.0427L31.1666 14.1667"
|
|
249
|
+
/>
|
|
250
|
+
|
|
251
|
+
<path
|
|
252
|
+
stroke-width="2.5"
|
|
253
|
+
stroke="currentColor"
|
|
254
|
+
d="M7.08331 17V8.50001C7.08331 5.82872 7.08331 4.49307 7.91318 3.66321C8.74304 2.83334 10.0787 2.83334 12.75 2.83334H21.25C23.9212 2.83334 25.2569 2.83334 26.0868 3.66321C26.9166 4.49307 26.9166 5.82872 26.9166 8.50001V17"
|
|
255
|
+
/>
|
|
256
|
+
|
|
257
|
+
<path
|
|
258
|
+
stroke-linejoin="round"
|
|
259
|
+
stroke-linecap="round"
|
|
260
|
+
stroke-width="2.5"
|
|
261
|
+
stroke="currentColor"
|
|
262
|
+
d="M14.1667 14.1667H19.8334M14.1667 8.5H19.8334"
|
|
263
|
+
/>
|
|
264
|
+
</svg>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<div class="content">
|
|
268
|
+
<h2 class="title">
|
|
269
|
+
{title}
|
|
270
|
+
</h2>
|
|
271
|
+
|
|
272
|
+
<p class="description">
|
|
273
|
+
{description}
|
|
274
|
+
</p>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<label class="sr-only" for={`${formId}-email`}>
|
|
278
|
+
Email address
|
|
279
|
+
</label>
|
|
280
|
+
|
|
281
|
+
<input
|
|
282
|
+
id={`${formId}-email`}
|
|
283
|
+
class="input"
|
|
284
|
+
type="email"
|
|
285
|
+
name="email"
|
|
286
|
+
autocomplete="email"
|
|
287
|
+
placeholder="Enter your email"
|
|
288
|
+
required
|
|
289
|
+
/>
|
|
290
|
+
|
|
291
|
+
<button
|
|
292
|
+
class="submit"
|
|
293
|
+
type="submit"
|
|
294
|
+
>
|
|
295
|
+
{submitLabel}
|
|
296
|
+
</button>
|
|
297
|
+
</form>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<script is:inline>
|
|
301
|
+
document.querySelectorAll("[data-newsletter-form]:not([data-newsletter-ready])").forEach((form) => {
|
|
302
|
+
form.setAttribute("data-newsletter-ready", "true");
|
|
303
|
+
form.addEventListener("submit", async (event) => {
|
|
304
|
+
event.preventDefault();
|
|
305
|
+
|
|
306
|
+
const formData = new FormData(form);
|
|
307
|
+
const email = formData.get("email");
|
|
308
|
+
const url = form.dataset.action;
|
|
309
|
+
|
|
310
|
+
console.log(`Submitting ${email} to ${url}`);
|
|
311
|
+
|
|
312
|
+
try {
|
|
313
|
+
// Simulating API call for demonstration. Replace with actual fetch call.
|
|
314
|
+
/*
|
|
315
|
+
const response = await fetch(url, {
|
|
316
|
+
method: "POST",
|
|
317
|
+
body: JSON.stringify({ email }),
|
|
318
|
+
headers: {
|
|
319
|
+
"Content-Type": "application/json",
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
*/
|
|
323
|
+
|
|
324
|
+
alert(`Thanks for subscribing with: ${email}\n(This would normally be sent to: ${url})`);
|
|
325
|
+
form.reset();
|
|
326
|
+
} catch (error) {
|
|
327
|
+
console.error("Subscription failed:", error);
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
</script>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
rating?: number;
|
|
6
|
+
reviews?: number;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
title,
|
|
12
|
+
description,
|
|
13
|
+
rating = 4.8,
|
|
14
|
+
reviews = 24,
|
|
15
|
+
class: className = "",
|
|
16
|
+
} = Astro.props;
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
/* ✅ CRITERION 7: CSS-FIRST */
|
|
21
|
+
|
|
22
|
+
[data-pgc] {
|
|
23
|
+
position: relative;
|
|
24
|
+
|
|
25
|
+
width: min(20rem, 100%);
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
|
|
28
|
+
border: 1px solid #e5e7eb;
|
|
29
|
+
border-radius: 1rem;
|
|
30
|
+
|
|
31
|
+
background: white;
|
|
32
|
+
color: #1f2937;
|
|
33
|
+
|
|
34
|
+
font-family:
|
|
35
|
+
Inter,
|
|
36
|
+
ui-sans-serif,
|
|
37
|
+
system-ui,
|
|
38
|
+
-apple-system,
|
|
39
|
+
BlinkMacSystemFont,
|
|
40
|
+
"Segoe UI",
|
|
41
|
+
Arial,
|
|
42
|
+
sans-serif;
|
|
43
|
+
|
|
44
|
+
-webkit-font-smoothing: antialiased;
|
|
45
|
+
-moz-osx-font-smoothing: grayscale;
|
|
46
|
+
|
|
47
|
+
box-shadow:
|
|
48
|
+
0 4px 10px rgba(0,0,0,0.06);
|
|
49
|
+
|
|
50
|
+
transition:
|
|
51
|
+
transform 500ms ease,
|
|
52
|
+
box-shadow 500ms ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-pgc]:hover,
|
|
56
|
+
[data-pgc]:focus-within {
|
|
57
|
+
transform: scale(1.05);
|
|
58
|
+
|
|
59
|
+
box-shadow:
|
|
60
|
+
0 10px 25px rgba(0,0,0,0.12);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Glow layer */
|
|
64
|
+
.glow {
|
|
65
|
+
position: absolute;
|
|
66
|
+
inset: 0;
|
|
67
|
+
|
|
68
|
+
background:
|
|
69
|
+
linear-gradient(
|
|
70
|
+
135deg,
|
|
71
|
+
#f3f4f6,
|
|
72
|
+
#ffffff
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
opacity: 0;
|
|
76
|
+
|
|
77
|
+
filter: blur(12px);
|
|
78
|
+
|
|
79
|
+
transition: opacity 500ms ease;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[data-pgc]:hover .glow,
|
|
83
|
+
[data-pgc]:focus-within .glow {
|
|
84
|
+
opacity: 0.3;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.content {
|
|
88
|
+
position: relative;
|
|
89
|
+
z-index: 1;
|
|
90
|
+
|
|
91
|
+
padding: 1.5rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.title {
|
|
95
|
+
margin: 0;
|
|
96
|
+
|
|
97
|
+
font-size: 1.25rem;
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
line-height: 1.3;
|
|
100
|
+
letter-spacing: -0.03em;
|
|
101
|
+
|
|
102
|
+
color: #1f2937;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.description {
|
|
106
|
+
margin-top: 0.75rem;
|
|
107
|
+
|
|
108
|
+
color: #4b5563;
|
|
109
|
+
line-height: 1.6;
|
|
110
|
+
|
|
111
|
+
font-size: 0.95rem;
|
|
112
|
+
font-weight: 400;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.meta {
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: 0.5rem;
|
|
119
|
+
|
|
120
|
+
margin-top: 1rem;
|
|
121
|
+
|
|
122
|
+
color: #4b5563;
|
|
123
|
+
|
|
124
|
+
font-size: 0.9rem;
|
|
125
|
+
font-weight: 500;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.star {
|
|
129
|
+
width: 1.5rem;
|
|
130
|
+
height: 1.5rem;
|
|
131
|
+
|
|
132
|
+
color: #eab308;
|
|
133
|
+
|
|
134
|
+
flex-shrink: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Accessibility */
|
|
138
|
+
[data-pgc]:focus-within {
|
|
139
|
+
outline: 2px solid #1f2937;
|
|
140
|
+
outline-offset: 4px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* ✅ CRITERION 6: REDUCED MOTION */
|
|
144
|
+
@media (prefers-reduced-motion: reduce) {
|
|
145
|
+
[data-pgc],
|
|
146
|
+
[data-pgc] * {
|
|
147
|
+
transition: none !important;
|
|
148
|
+
transform: none !important;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
152
|
+
|
|
153
|
+
<article
|
|
154
|
+
data-pgc
|
|
155
|
+
class={className}
|
|
156
|
+
>
|
|
157
|
+
<div
|
|
158
|
+
class="glow"
|
|
159
|
+
aria-hidden="true"
|
|
160
|
+
></div>
|
|
161
|
+
|
|
162
|
+
<div class="content">
|
|
163
|
+
<p class="title">{title}</p>
|
|
164
|
+
|
|
165
|
+
<p class="description">
|
|
166
|
+
{description}
|
|
167
|
+
</p>
|
|
168
|
+
|
|
169
|
+
<div class="meta">
|
|
170
|
+
<svg
|
|
171
|
+
class="star"
|
|
172
|
+
viewBox="0 0 24 24"
|
|
173
|
+
fill="currentColor"
|
|
174
|
+
aria-hidden="true"
|
|
175
|
+
>
|
|
176
|
+
<path
|
|
177
|
+
d="M12 17.27L18.18 21l-1.64-7.03L22
|
|
178
|
+
9.24l-7.19-.61L12 2 9.19 8.63
|
|
179
|
+
2 9.24l5.46 4.73L5.82 21z"
|
|
180
|
+
/>
|
|
181
|
+
</svg>
|
|
182
|
+
|
|
183
|
+
<span>
|
|
184
|
+
{rating} ({reviews} reviews)
|
|
185
|
+
</span>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</article>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
/**
|
|
4
|
+
* Progress value (0–max).
|
|
5
|
+
* @required
|
|
6
|
+
*/
|
|
7
|
+
value: number;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Maximum value. Used to compute the percentage width.
|
|
11
|
+
* @default 100
|
|
12
|
+
*/
|
|
13
|
+
max?: number;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Label text for the progress bar.
|
|
17
|
+
*/
|
|
18
|
+
label?: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Size variant: "small", "medium", or "large".
|
|
22
|
+
* @default "medium"
|
|
23
|
+
*/
|
|
24
|
+
size?: "small" | "medium" | "large";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Bar fill color.
|
|
28
|
+
* @default "#3b82f6"
|
|
29
|
+
*/
|
|
30
|
+
color?: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Track background color.
|
|
34
|
+
* @default "#e5e7eb"
|
|
35
|
+
*/
|
|
36
|
+
trackColor?: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Optional class applied to the root element.
|
|
40
|
+
*/
|
|
41
|
+
class?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const {
|
|
45
|
+
value,
|
|
46
|
+
max = 100,
|
|
47
|
+
label,
|
|
48
|
+
size = "medium",
|
|
49
|
+
color = "#3b82f6",
|
|
50
|
+
trackColor = "#e5e7eb",
|
|
51
|
+
class: className = "",
|
|
52
|
+
} = Astro.props;
|
|
53
|
+
|
|
54
|
+
const clampedValue = Math.min(Math.max(value, 0), max);
|
|
55
|
+
const percentage = Math.round((clampedValue / max) * 100);
|
|
56
|
+
|
|
57
|
+
const sizeStyles = {
|
|
58
|
+
small: {
|
|
59
|
+
height: "4px",
|
|
60
|
+
labelSize: "12px",
|
|
61
|
+
},
|
|
62
|
+
medium: {
|
|
63
|
+
height: "8px",
|
|
64
|
+
labelSize: "14px",
|
|
65
|
+
},
|
|
66
|
+
large: {
|
|
67
|
+
height: "12px",
|
|
68
|
+
labelSize: "16px",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const currentSize = sizeStyles[size];
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
<style>
|
|
76
|
+
.progress-root {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: 8px;
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.progress-label {
|
|
84
|
+
font-size: var(--label-size, 14px);
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
color: #374151;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@media (prefers-color-scheme: dark) {
|
|
90
|
+
.progress-label {
|
|
91
|
+
color: #000;
|
|
92
|
+
font-family: sans-serif;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.progress-track {
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: var(--track-height, 8px);
|
|
99
|
+
background: var(--track-color, #e5e7eb);
|
|
100
|
+
border-radius: 9999px;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.progress-fill {
|
|
105
|
+
height: 100%;
|
|
106
|
+
width: var(--progress, 0%);
|
|
107
|
+
background: var(--fill-color, #3b82f6);
|
|
108
|
+
border-radius: 9999px;
|
|
109
|
+
transition: width 300ms ease-out;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@media (prefers-reduced-motion: reduce) {
|
|
113
|
+
.progress-fill {
|
|
114
|
+
transition: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
118
|
+
|
|
119
|
+
<div
|
|
120
|
+
class:list={["progress-root", className]}
|
|
121
|
+
role="progressbar"
|
|
122
|
+
aria-valuenow={clampedValue}
|
|
123
|
+
aria-valuemin={0}
|
|
124
|
+
aria-valuemax={max}
|
|
125
|
+
aria-label={label}
|
|
126
|
+
style={`
|
|
127
|
+
--progress: ${percentage}%;
|
|
128
|
+
--track-height: ${currentSize.height};
|
|
129
|
+
--label-size: ${currentSize.labelSize};
|
|
130
|
+
--fill-color: ${color};
|
|
131
|
+
`}
|
|
132
|
+
>
|
|
133
|
+
{label && <div class="progress-label">{label}</div>}
|
|
134
|
+
<div class="progress-track" style={`background: ${trackColor};`}>
|
|
135
|
+
<div class="progress-fill"></div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|