astro-component-kit 0.4.0 → 0.4.1
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/README.md +105 -27
- package/package.json +16 -3
- package/src/components/index.ts +2 -0
- package/src/components/lib/Galaxy3D.astro +249 -137
- package/src/components/lib/app/AppSidebar.astro +249 -0
- package/src/components/lib/app/AppTopbar.astro +284 -0
- package/src/components/lib/app/ArrivalsBoard.astro +176 -0
- package/src/components/lib/app/AuthCard.astro +213 -0
- package/src/components/lib/app/DataTable.astro +346 -0
- package/src/components/lib/app/GuestProfileCard.astro +133 -0
- package/src/components/lib/app/HousekeepingBoard.astro +189 -0
- package/src/components/lib/app/PageHeader.astro +157 -0
- package/src/components/lib/app/PlanUsageCard.astro +112 -0
- package/src/components/lib/app/RoomRack.astro +207 -0
- package/src/components/lib/app/SettingsSection.astro +96 -0
- package/src/components/lib/app/SwitchRow.astro +71 -0
- package/src/components/lib/app/TeamMembers.astro +190 -0
- package/src/components/lib/app/app-icons.ts +52 -0
- package/src/components/lib/app/index.ts +19 -0
- package/src/components/lib/charts/AreaChart.astro +4 -4
- package/src/components/lib/charts/BarChart.astro +3 -3
- package/src/components/lib/charts/ChartFrame.astro +10 -10
- package/src/components/lib/charts/DonutChart.astro +2 -2
- package/src/components/lib/charts/DumbbellChart.astro +1 -1
- package/src/components/lib/charts/ForecastLineChart.astro +1 -1
- package/src/components/lib/charts/GaugeChart.astro +1 -1
- package/src/components/lib/charts/HeatmapChart.astro +1 -1
- package/src/components/lib/charts/HorizontalBarChart.astro +2 -2
- package/src/components/lib/charts/KpiStatTile.astro +4 -4
- package/src/components/lib/charts/LinearProgressGauge.astro +4 -4
- package/src/components/lib/charts/MetricDeltaTable.astro +3 -3
- package/src/components/lib/charts/RadarMetricChart.astro +4 -4
- package/src/components/lib/charts/RadialBarChart.astro +1 -1
- package/src/components/lib/charts/RetentionCohortTable.astro +2 -2
- package/src/components/lib/charts/TreemapChart.astro +1 -1
- package/src/components/lib/ecommerce/CartDrawer.astro +483 -0
- package/src/components/lib/ecommerce/CartPageList.astro +290 -0
- package/src/components/lib/ecommerce/CartToast.astro +276 -0
- package/src/components/lib/ecommerce/CategoryTiles.astro +143 -0
- package/src/components/lib/ecommerce/CheckoutForm.astro +423 -0
- package/src/components/lib/ecommerce/CountdownBanner.astro +230 -0
- package/src/components/lib/ecommerce/FilterBar.astro +278 -0
- package/src/components/lib/ecommerce/FilterSidebar.astro +405 -0
- package/src/components/lib/ecommerce/LiveActivityToast.astro +213 -0
- package/src/components/lib/ecommerce/OrderSummary.astro +295 -0
- package/src/components/lib/ecommerce/ProductBuyBox.astro +247 -0
- package/src/components/lib/ecommerce/ProductCardMinimal.astro +229 -0
- package/src/components/lib/ecommerce/ProductGallery.astro +145 -0
- package/src/components/lib/ecommerce/ProductGrid.astro +118 -0
- package/src/components/lib/ecommerce/ProductMedia.astro +113 -0
- package/src/components/lib/ecommerce/ProductRating.astro +78 -0
- package/src/components/lib/ecommerce/ProductToolbar.astro +93 -0
- package/src/components/lib/ecommerce/PromoBar.astro +145 -0
- package/src/components/lib/ecommerce/StockIndicator.astro +127 -0
- package/src/components/lib/ecommerce/StoreHeader.astro +446 -0
- package/src/components/lib/ecommerce/StoreHero.astro +260 -0
- package/src/components/lib/ecommerce/StoreProductCard.astro +307 -0
- package/src/components/lib/ecommerce/TrustBadges.astro +101 -0
- package/src/components/lib/ecommerce/VariantPicker.astro +145 -0
- package/src/components/lib/ecommerce/cart-store.ts +151 -0
- package/src/components/lib/ecommerce/catalog-filter.ts +62 -0
- package/src/components/lib/ecommerce/index.ts +34 -0
- package/src/components/lib/ecommerce/product-icons.ts +28 -0
- package/src/components/lib/ecommerce/types.ts +70 -0
- package/src/components/lib/forms/AnimatedInput.astro +4 -2
- package/src/components/lib/forms/CustomRadioGroup.astro +3 -1
- package/src/components/lib/index.ts +2 -0
- package/src/components/lib/layout/BentoGrid3.astro +6 -4
- package/src/components/lib/layout/CenterFixedBox.astro +2 -2
- package/src/components/lib/layout/CenteredContainer.astro +4 -2
- package/src/components/lib/layout/ClusterHorizontal.astro +2 -2
- package/src/components/lib/layout/FeatureHero.astro +4 -2
- package/src/components/lib/layout/FooterCenteredMinimal.astro +4 -2
- package/src/components/lib/layout/FullBleedSection.astro +2 -2
- package/src/components/lib/layout/GalleryGrid4.astro +2 -2
- package/src/components/lib/layout/HolyGrailGrid.astro +11 -9
- package/src/components/lib/layout/LandingSectionSplit.astro +5 -3
- package/src/components/lib/layout/MasonryGrid.astro +2 -2
- package/src/components/lib/layout/MinimalFooterGrid.astro +1 -1
- package/src/components/lib/layout/ScrollSnapSection.astro +1 -1
- package/src/components/lib/layout/SidebarLayoutWrapper.astro +4 -2
- package/src/components/lib/layout/SplitScreenLayout.astro +3 -3
- package/src/components/lib/layout/StepLayoutVertical.astro +1 -1
- package/src/components/lib/layout/StickySidebarWrapper.astro +4 -2
- package/src/components/lib/sections/AgencyContactBrief.astro +194 -0
- package/src/components/lib/sections/AgencyFooterCta.astro +94 -0
- package/src/components/lib/sections/AgencyHeader.astro +161 -0
- package/src/components/lib/sections/AgencyHeroKinetic.astro +172 -0
- package/src/components/lib/sections/AgencyServicesList.astro +113 -0
- package/src/components/lib/sections/AgencyTeamGrid.astro +111 -0
- package/src/components/lib/sections/AgencyWorkGrid.astro +147 -0
- package/src/components/lib/sections/BlogGridSection.astro +9 -7
- package/src/components/lib/sections/ButtonsShowcase.astro +20 -18
- package/src/components/lib/sections/CardsShowcase.astro +28 -26
- package/src/components/lib/sections/CareersOpenings.astro +10 -8
- package/src/components/lib/sections/ChangelogSection.astro +14 -7
- package/src/components/lib/sections/ContactGlassForm.astro +10 -8
- package/src/components/lib/sections/ContactSplitMap.astro +11 -9
- package/src/components/lib/sections/CtaAppDownload.astro +13 -11
- package/src/components/lib/sections/CtaGlowBanner.astro +12 -10
- package/src/components/lib/sections/CtaNewsletterSection.astro +13 -11
- package/src/components/lib/sections/CtaSplitImage.astro +13 -11
- package/src/components/lib/sections/DataShowcase.astro +23 -21
- package/src/components/lib/sections/FaqAccordionSection.astro +8 -8
- package/src/components/lib/sections/FaqTwoColumn.astro +9 -7
- package/src/components/lib/sections/FeatureAlternatingRows.astro +10 -8
- package/src/components/lib/sections/FeatureBentoGrid.astro +13 -11
- package/src/components/lib/sections/FeatureIconGrid.astro +6 -6
- package/src/components/lib/sections/FeatureTabsShowcase.astro +13 -11
- package/src/components/lib/sections/FeatureTimelineFlow.astro +8 -6
- package/src/components/lib/sections/FeedbackShowcase.astro +15 -13
- package/src/components/lib/sections/FooterMegaSection.astro +13 -11
- package/src/components/lib/sections/FormsShowcase.astro +22 -20
- package/src/components/lib/sections/HeroDashboardPreview.astro +11 -9
- package/src/components/lib/sections/HeroGlass.astro +22 -20
- package/src/components/lib/sections/HeroGradient.astro +15 -13
- package/src/components/lib/sections/HeroMinimalCentered.astro +10 -10
- package/src/components/lib/sections/HeroShowcaseSplit.astro +18 -16
- package/src/components/lib/sections/HeroSplit.astro +13 -11
- package/src/components/lib/sections/HeroTerminal.astro +14 -12
- package/src/components/lib/sections/HeroWaitlist.astro +10 -8
- package/src/components/lib/sections/HowItWorksSteps.astro +12 -10
- package/src/components/lib/sections/IntegrationsGrid.astro +7 -7
- package/src/components/lib/sections/LayoutShowcase.astro +21 -19
- package/src/components/lib/sections/LogoCloudSection.astro +4 -4
- package/src/components/lib/sections/LogoWallGrid.astro +6 -4
- package/src/components/lib/sections/NavigationShowcase.astro +15 -13
- package/src/components/lib/sections/OverlaysShowcase.astro +21 -19
- package/src/components/lib/sections/PricingComparisonMatrix.astro +15 -13
- package/src/components/lib/sections/PricingSinglePlan.astro +13 -11
- package/src/components/lib/sections/PricingTierCards.astro +11 -9
- package/src/components/lib/sections/PricingToggleCards.astro +13 -13
- package/src/components/lib/sections/ShopCategoryHero.astro +103 -0
- package/src/components/lib/sections/ShopCollectionMosaic.astro +131 -0
- package/src/components/lib/sections/ShopFooterWordmark.astro +100 -0
- package/src/components/lib/sections/ShopHeaderEditorial.astro +396 -0
- package/src/components/lib/sections/ShopHeroEditorial.astro +151 -0
- package/src/components/lib/sections/ShopLookbook.astro +250 -0
- package/src/components/lib/sections/ShopNewsletterEditorial.astro +128 -0
- package/src/components/lib/sections/ShopProductRail.astro +150 -0
- package/src/components/lib/sections/ShopReviewsEditorial.astro +133 -0
- package/src/components/lib/sections/ShopValuesMarquee.astro +91 -0
- package/src/components/lib/sections/StatsCounterBand.astro +9 -7
- package/src/components/lib/sections/StatsDashboardSection.astro +4 -2
- package/src/components/lib/sections/StatsMetricShowcase.astro +9 -7
- package/src/components/lib/sections/TeamGridSection.astro +12 -10
- package/src/components/lib/sections/TestimonialCarousel.astro +10 -8
- package/src/components/lib/sections/TestimonialFeatured.astro +7 -5
- package/src/components/lib/sections/TestimonialGridSection.astro +7 -7
- package/src/components/lib/sections/TestimonialWallGlass.astro +11 -9
- package/src/components/lib/sections/TypographyShowcase.astro +10 -8
- package/src/components/lib/sections/index.ts +10 -0
- package/src/components/lib/templates/ecommerce/StoreCategoryPage.astro +160 -0
- package/src/components/lib/templates/ecommerce/StoreCheckoutPage.astro +98 -0
- package/src/components/lib/templates/ecommerce/StoreHomePage.astro +191 -0
- package/src/components/lib/templates/ecommerce/StoreLayout.astro +169 -0
- package/src/components/lib/templates/ecommerce/StoreProductPage.astro +165 -0
- package/src/components/lib/templates/ecommerce/data.ts +187 -0
- package/src/components/lib/templates/ecommerce/index.ts +14 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialBagPage.astro +52 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialCheckoutPage.astro +123 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialHomePage.astro +102 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialLayout.astro +216 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialProductPage.astro +205 -0
- package/src/components/lib/templates/ecommerce-editorial/EditorialShopPage.astro +112 -0
- package/src/components/lib/templates/ecommerce-editorial/data.ts +125 -0
- package/src/components/lib/templates/ecommerce-editorial/index.ts +16 -0
- package/src/components/lib/templates/saas-hotel/AppLayout.astro +83 -0
- package/src/components/lib/templates/saas-hotel/DashboardPage.astro +66 -0
- package/src/components/lib/templates/saas-hotel/GuestsPage.astro +65 -0
- package/src/components/lib/templates/saas-hotel/LandingPage.astro +213 -0
- package/src/components/lib/templates/saas-hotel/ReportsPage.astro +63 -0
- package/src/components/lib/templates/saas-hotel/ReservationsPage.astro +49 -0
- package/src/components/lib/templates/saas-hotel/RoomsPage.astro +48 -0
- package/src/components/lib/templates/saas-hotel/SettingsPage.astro +115 -0
- package/src/components/lib/templates/saas-hotel/SignInPage.astro +50 -0
- package/src/components/lib/templates/saas-hotel/data.ts +229 -0
- package/src/components/lib/templates/saas-hotel/index.ts +19 -0
- package/src/components/lib/templates/saas-hotel/lobby-theme.css +90 -0
- package/src/styles/global.css +95 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* StoreHero — Shop landing hero: headline, CTAs, quick stats and a featured product
|
|
4
|
+
* stage with floating price and rating chips.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} eyebrow - Small label above the title. Default 'New season · 2026'.
|
|
7
|
+
* @param {string} title - Headline. Default 'Gear that feels'.
|
|
8
|
+
* @param {string} highlight - Gradient part of the headline. Default 'made for you'.
|
|
9
|
+
* @param {string} subtitle - Supporting copy.
|
|
10
|
+
* @param {{label: string, href: string}} primary - Main CTA.
|
|
11
|
+
* @param {{label: string, href: string}} secondary - Secondary CTA (optional).
|
|
12
|
+
* @param {Array<{value: string, label: string}>} stats - Proof points below the CTAs.
|
|
13
|
+
* @param {Product} product - Featured product shown on the stage.
|
|
14
|
+
* @param {string} productHref - Featured product link.
|
|
15
|
+
* @param {string} currency - ISO currency. Default 'USD'.
|
|
16
|
+
* @param {string} locale - Number format locale. Default 'en-US'.
|
|
17
|
+
* @param {string} variant - Layout (split|centered). Default 'split'.
|
|
18
|
+
* @param {string} size - Vertical rhythm (sm|md|lg). Default 'md'.
|
|
19
|
+
* @param {string} className - Extra class.
|
|
20
|
+
*
|
|
21
|
+
* Accessibility: one h1; decorative stage art is aria-hidden; the featured product is a real link.
|
|
22
|
+
*/
|
|
23
|
+
import ProductMedia from './ProductMedia.astro';
|
|
24
|
+
import ProductRating from './ProductRating.astro';
|
|
25
|
+
import { formatMoney } from './cart-store';
|
|
26
|
+
import type { Product } from './types';
|
|
27
|
+
|
|
28
|
+
interface Cta { label: string; href: string }
|
|
29
|
+
interface Props {
|
|
30
|
+
eyebrow?: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
highlight?: string;
|
|
33
|
+
subtitle?: string;
|
|
34
|
+
primary?: Cta;
|
|
35
|
+
secondary?: Cta;
|
|
36
|
+
stats?: Array<{ value: string; label: string }>;
|
|
37
|
+
product?: Product;
|
|
38
|
+
productHref?: string;
|
|
39
|
+
currency?: string;
|
|
40
|
+
locale?: string;
|
|
41
|
+
variant?: 'split' | 'centered';
|
|
42
|
+
size?: 'sm' | 'md' | 'lg';
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
eyebrow = 'New season · 2026',
|
|
48
|
+
title = 'Gear that feels',
|
|
49
|
+
highlight = 'made for you',
|
|
50
|
+
subtitle = 'Thoughtfully designed audio, wearables and everyday carry. Free shipping over $75 and 30-day returns on everything.',
|
|
51
|
+
primary = { label: 'Shop the collection', href: '#' },
|
|
52
|
+
secondary = { label: 'Explore new arrivals', href: '#' },
|
|
53
|
+
stats = [
|
|
54
|
+
{ value: '4.9/5', label: 'from 12k reviews' },
|
|
55
|
+
{ value: '48h', label: 'average delivery' },
|
|
56
|
+
{ value: '30 days', label: 'free returns' },
|
|
57
|
+
],
|
|
58
|
+
product = { slug: 'aurora-headphones', name: 'Aurora Wireless Headphones', price: 189, compareAt: 229, category: 'audio', rating: 4.8, reviews: 312, icon: 'headphones', hue: 38 },
|
|
59
|
+
productHref = '#',
|
|
60
|
+
currency = 'USD',
|
|
61
|
+
locale = 'en-US',
|
|
62
|
+
variant = 'split',
|
|
63
|
+
size = 'md',
|
|
64
|
+
className = '',
|
|
65
|
+
} = Astro.props;
|
|
66
|
+
|
|
67
|
+
const money = { currency, locale };
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
<section class:list={['store-hero', `store-hero--${variant}`, `store-hero--${size}`, className]}>
|
|
71
|
+
<div class="store-hero__glow" aria-hidden="true"></div>
|
|
72
|
+
<div class="store-hero__inner">
|
|
73
|
+
<div class="store-hero__copy">
|
|
74
|
+
{eyebrow && <p class="store-hero__eyebrow"><span aria-hidden="true"></span>{eyebrow}</p>}
|
|
75
|
+
<h1 class="store-hero__title">{title} <em>{highlight}</em></h1>
|
|
76
|
+
{subtitle && <p class="store-hero__subtitle">{subtitle}</p>}
|
|
77
|
+
<div class="store-hero__ctas">
|
|
78
|
+
{primary && (
|
|
79
|
+
<a class="store-hero__btn store-hero__btn--primary" href={primary.href}>
|
|
80
|
+
{primary.label}
|
|
81
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg>
|
|
82
|
+
</a>
|
|
83
|
+
)}
|
|
84
|
+
{secondary && <a class="store-hero__btn store-hero__btn--ghost" href={secondary.href}>{secondary.label}</a>}
|
|
85
|
+
</div>
|
|
86
|
+
{stats.length > 0 && (
|
|
87
|
+
<dl class="store-hero__stats">
|
|
88
|
+
{stats.map((s) => (
|
|
89
|
+
<div><dt>{s.label}</dt><dd>{s.value}</dd></div>
|
|
90
|
+
))}
|
|
91
|
+
</dl>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
{product && (
|
|
96
|
+
<div class="store-hero__stage">
|
|
97
|
+
<div class="store-hero__ring" aria-hidden="true"></div>
|
|
98
|
+
<a class="store-hero__product" href={productHref}>
|
|
99
|
+
<ProductMedia image={product.image} alt={product.name} icon={product.icon} hue={product.hue} size="lg" ratio="4 / 5" />
|
|
100
|
+
<span class="store-hero__chip store-hero__chip--price">
|
|
101
|
+
<small>{product.name}</small>
|
|
102
|
+
<strong>{formatMoney(product.price, money)}</strong>
|
|
103
|
+
{product.compareAt && <s><span class="sr-only">Was </span>{formatMoney(product.compareAt, money)}</s>}
|
|
104
|
+
</span>
|
|
105
|
+
{product.rating !== undefined && (
|
|
106
|
+
<span class="store-hero__chip store-hero__chip--rating">
|
|
107
|
+
<ProductRating value={product.rating} count={product.reviews} />
|
|
108
|
+
</span>
|
|
109
|
+
)}
|
|
110
|
+
</a>
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
</div>
|
|
114
|
+
</section>
|
|
115
|
+
|
|
116
|
+
<style>
|
|
117
|
+
.store-hero {
|
|
118
|
+
container-type: inline-size;
|
|
119
|
+
--hero-pad: clamp(3rem, 7vw, 6rem);
|
|
120
|
+
position: relative;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
padding: var(--hero-pad) var(--sp-6, 1.5rem);
|
|
123
|
+
isolation: isolate;
|
|
124
|
+
}
|
|
125
|
+
.store-hero--sm { --hero-pad: clamp(2rem, 5vw, 3.5rem); }
|
|
126
|
+
.store-hero--lg { --hero-pad: clamp(4rem, 9vw, 8rem); }
|
|
127
|
+
|
|
128
|
+
.store-hero__glow {
|
|
129
|
+
position: absolute;
|
|
130
|
+
inset: -20% -10% auto 30%;
|
|
131
|
+
height: 120%;
|
|
132
|
+
background: radial-gradient(closest-side, rgba(212, 160, 23, 0.16), transparent 70%);
|
|
133
|
+
z-index: -1;
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.store-hero__inner {
|
|
138
|
+
display: grid;
|
|
139
|
+
grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: clamp(2rem, 5vw, 4rem);
|
|
142
|
+
max-width: 1280px;
|
|
143
|
+
margin: 0 auto;
|
|
144
|
+
}
|
|
145
|
+
.store-hero--centered .store-hero__inner { grid-template-columns: 1fr; text-align: center; justify-items: center; }
|
|
146
|
+
.store-hero--centered .store-hero__ctas, .store-hero--centered .store-hero__stats { justify-content: center; }
|
|
147
|
+
.store-hero--centered .store-hero__stage { max-width: 420px; }
|
|
148
|
+
|
|
149
|
+
.store-hero__eyebrow {
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: var(--sp-2, 0.5rem);
|
|
153
|
+
margin: 0 0 var(--sp-4, 1rem);
|
|
154
|
+
padding: 0.35rem 0.85rem;
|
|
155
|
+
border-radius: var(--r-full, 9999px);
|
|
156
|
+
border: 1px solid rgba(212, 160, 23, 0.3);
|
|
157
|
+
background: rgba(212, 160, 23, 0.08);
|
|
158
|
+
color: var(--c-accent, #fef3c7);
|
|
159
|
+
font-size: 0.75rem;
|
|
160
|
+
font-weight: 700;
|
|
161
|
+
letter-spacing: 0.06em;
|
|
162
|
+
text-transform: uppercase;
|
|
163
|
+
}
|
|
164
|
+
.store-hero__eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: var(--c-primary-light, #d4a017); box-shadow: 0 0 10px var(--c-primary-light, #d4a017); }
|
|
165
|
+
|
|
166
|
+
.store-hero__title {
|
|
167
|
+
margin: 0;
|
|
168
|
+
font-size: clamp(2.4rem, 6vw, 4.6rem);
|
|
169
|
+
font-weight: 900;
|
|
170
|
+
line-height: 1.02;
|
|
171
|
+
letter-spacing: -0.04em;
|
|
172
|
+
color: var(--c-text-1, #fff);
|
|
173
|
+
}
|
|
174
|
+
.store-hero__title em {
|
|
175
|
+
display: block;
|
|
176
|
+
font-style: normal;
|
|
177
|
+
background: linear-gradient(100deg, var(--c-accent, #fef3c7), var(--c-primary-light, #d4a017) 55%, var(--c-primary, #b8860b));
|
|
178
|
+
-webkit-background-clip: text;
|
|
179
|
+
background-clip: text;
|
|
180
|
+
color: transparent;
|
|
181
|
+
}
|
|
182
|
+
.store-hero__subtitle { max-width: 34rem; margin: var(--sp-5, 1.25rem) 0 0; font-size: 1.05rem; line-height: 1.65; color: var(--c-text-2, #a3a3a3); }
|
|
183
|
+
.store-hero--centered .store-hero__subtitle { margin-inline: auto; }
|
|
184
|
+
|
|
185
|
+
.store-hero__ctas { display: flex; flex-wrap: wrap; gap: var(--sp-3, 0.75rem); margin-top: var(--sp-8, 2rem); }
|
|
186
|
+
.store-hero__btn {
|
|
187
|
+
display: inline-flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
gap: var(--sp-2, 0.5rem);
|
|
190
|
+
min-height: 52px;
|
|
191
|
+
padding: 0 var(--sp-6, 1.5rem);
|
|
192
|
+
border-radius: var(--r-full, 9999px);
|
|
193
|
+
font-weight: 700;
|
|
194
|
+
font-size: 0.95rem;
|
|
195
|
+
text-decoration: none;
|
|
196
|
+
transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease;
|
|
197
|
+
}
|
|
198
|
+
.store-hero__btn--primary { background: var(--c-primary-light, #d4a017); color: var(--c-on-primary, #050505); }
|
|
199
|
+
.store-hero__btn--primary:hover { color: var(--c-on-primary, #050505); filter: brightness(1.08); transform: translateY(-2px); }
|
|
200
|
+
.store-hero__btn--ghost { border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.14); color: var(--c-text-1, #fff); }
|
|
201
|
+
.store-hero__btn--ghost:hover { background: rgb(var(--ink-rgb, 255 255 255) / 0.05); color: var(--c-text-1, #fff); }
|
|
202
|
+
.store-hero__btn:focus-visible, .store-hero__product:focus-visible { outline: 2px solid var(--c-primary-light, #d4a017); outline-offset: 3px; }
|
|
203
|
+
|
|
204
|
+
.store-hero__stats { display: flex; flex-wrap: wrap; gap: var(--sp-8, 2rem); margin: var(--sp-10, 2.5rem) 0 0; }
|
|
205
|
+
.store-hero__stats div { display: flex; flex-direction: column-reverse; }
|
|
206
|
+
.store-hero__stats dt { font-size: 0.8rem; color: var(--c-text-2, #a3a3a3); }
|
|
207
|
+
.store-hero__stats dd { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--c-text-1, #fff); letter-spacing: -0.02em; }
|
|
208
|
+
|
|
209
|
+
.store-hero__stage { position: relative; width: 100%; max-width: 480px; justify-self: center; }
|
|
210
|
+
.store-hero__ring {
|
|
211
|
+
position: absolute;
|
|
212
|
+
inset: 8% -6%;
|
|
213
|
+
border-radius: 50%;
|
|
214
|
+
border: 1px dashed rgba(212, 160, 23, 0.25);
|
|
215
|
+
animation: sh-spin 40s linear infinite;
|
|
216
|
+
}
|
|
217
|
+
.store-hero__product {
|
|
218
|
+
position: relative;
|
|
219
|
+
display: block;
|
|
220
|
+
border-radius: var(--r-xl, 28px);
|
|
221
|
+
border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.08);
|
|
222
|
+
overflow: visible;
|
|
223
|
+
color: inherit;
|
|
224
|
+
text-decoration: none;
|
|
225
|
+
animation: sh-float 7s ease-in-out infinite;
|
|
226
|
+
}
|
|
227
|
+
.store-hero__product :global(.p-media) { border-radius: var(--r-xl, 28px); }
|
|
228
|
+
.store-hero__chip {
|
|
229
|
+
position: absolute;
|
|
230
|
+
display: grid;
|
|
231
|
+
gap: 2px;
|
|
232
|
+
padding: var(--sp-3, 0.75rem) var(--sp-4, 1rem);
|
|
233
|
+
border-radius: var(--r-md, 12px);
|
|
234
|
+
border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.1);
|
|
235
|
+
background: rgb(var(--paper-rgb, 5 5 5) / 0.78);
|
|
236
|
+
backdrop-filter: blur(14px);
|
|
237
|
+
box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.8);
|
|
238
|
+
text-align: left;
|
|
239
|
+
}
|
|
240
|
+
.store-hero__chip--price { left: -6%; bottom: 12%; }
|
|
241
|
+
.store-hero__chip--price small { font-size: 0.72rem; color: var(--c-text-2, #a3a3a3); }
|
|
242
|
+
.store-hero__chip--price strong { font-size: 1.25rem; color: var(--c-text-1, #fff); }
|
|
243
|
+
.store-hero__chip--price s { font-size: 0.78rem; color: var(--c-text-2, #a3a3a3); }
|
|
244
|
+
.store-hero__chip--rating { right: -4%; top: 10%; }
|
|
245
|
+
|
|
246
|
+
@keyframes sh-float { 50% { transform: translateY(-10px); } }
|
|
247
|
+
@keyframes sh-spin { to { transform: rotate(360deg); } }
|
|
248
|
+
|
|
249
|
+
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
250
|
+
|
|
251
|
+
@container (max-width: 900px) {
|
|
252
|
+
.store-hero__inner { grid-template-columns: 1fr; }
|
|
253
|
+
.store-hero__stage { max-width: 360px; }
|
|
254
|
+
.store-hero__chip--price { left: 0; }
|
|
255
|
+
.store-hero__chip--rating { right: 0; }
|
|
256
|
+
}
|
|
257
|
+
@media (prefers-reduced-motion: reduce) {
|
|
258
|
+
.store-hero__product, .store-hero__ring { animation: none; }
|
|
259
|
+
}
|
|
260
|
+
</style>
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* StoreProductCard — Shop product tile with media, badge, rating, colour swatches,
|
|
4
|
+
* price (with compare-at), wishlist toggle and an add-to-cart button wired to the cart store.
|
|
5
|
+
*
|
|
6
|
+
* @param {Product} product - Product data (see ecommerce/types.ts). A demo product is used by default.
|
|
7
|
+
* @param {string} href - Product page URL. Default '#'.
|
|
8
|
+
* @param {string} categoryLabel - Small label above the title (e.g. category name).
|
|
9
|
+
* @param {string} currency - ISO currency. Default 'USD'.
|
|
10
|
+
* @param {string} locale - Number format locale. Default 'en-US'.
|
|
11
|
+
* @param {string} ctaLabel - Add-to-cart label. Default 'Add to cart'.
|
|
12
|
+
* @param {string} addedLabel - Label shown briefly after adding. Default 'Added'.
|
|
13
|
+
* @param {string} cartKey - Cart storage key (several stores on one domain). Default 'ack-cart'.
|
|
14
|
+
* @param {boolean} openCart - Open the CartDrawer after adding; false fires a CartToast instead. Default true.
|
|
15
|
+
* @param {string} variant - Visual style (glass|minimal|bordered). Default 'glass'.
|
|
16
|
+
* @param {string} size - Card density (sm|md|lg). Default 'md'.
|
|
17
|
+
* @param {string} headingLevel - Title element (h2|h3|h4). Default 'h3'.
|
|
18
|
+
* @param {string} className - Extra class.
|
|
19
|
+
*
|
|
20
|
+
* Accessibility: the title link covers the whole card (stretched link) so there are no
|
|
21
|
+
* nested interactive elements; wishlist uses aria-pressed; out-of-stock disables the button.
|
|
22
|
+
*/
|
|
23
|
+
import ProductMedia from './ProductMedia.astro';
|
|
24
|
+
import ProductRating from './ProductRating.astro';
|
|
25
|
+
import Badge from '../feedback/Badge.astro';
|
|
26
|
+
import { formatMoney } from './cart-store';
|
|
27
|
+
import type { Product } from './types';
|
|
28
|
+
|
|
29
|
+
interface Props {
|
|
30
|
+
product?: Product;
|
|
31
|
+
href?: string;
|
|
32
|
+
categoryLabel?: string;
|
|
33
|
+
currency?: string;
|
|
34
|
+
locale?: string;
|
|
35
|
+
ctaLabel?: string;
|
|
36
|
+
addedLabel?: string;
|
|
37
|
+
cartKey?: string;
|
|
38
|
+
openCart?: boolean;
|
|
39
|
+
variant?: 'glass' | 'minimal' | 'bordered';
|
|
40
|
+
size?: 'sm' | 'md' | 'lg';
|
|
41
|
+
headingLevel?: 'h2' | 'h3' | 'h4';
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const {
|
|
46
|
+
product = {
|
|
47
|
+
slug: 'aurora-headphones',
|
|
48
|
+
name: 'Aurora Wireless Headphones',
|
|
49
|
+
price: 189,
|
|
50
|
+
compareAt: 229,
|
|
51
|
+
category: 'audio',
|
|
52
|
+
rating: 4.8,
|
|
53
|
+
reviews: 312,
|
|
54
|
+
badge: '-18%',
|
|
55
|
+
badgeVariant: 'warning',
|
|
56
|
+
colors: [{ name: 'Graphite', hex: '#2b2b2f' }, { name: 'Sand', hex: '#d8c3a5' }, { name: 'Ocean', hex: '#3d6f9e' }],
|
|
57
|
+
icon: 'headphones',
|
|
58
|
+
hue: 38,
|
|
59
|
+
inStock: true,
|
|
60
|
+
},
|
|
61
|
+
href = '#',
|
|
62
|
+
categoryLabel = 'Audio',
|
|
63
|
+
currency = 'USD',
|
|
64
|
+
locale = 'en-US',
|
|
65
|
+
ctaLabel = 'Add to cart',
|
|
66
|
+
addedLabel = 'Added',
|
|
67
|
+
cartKey = 'ack-cart',
|
|
68
|
+
openCart = true,
|
|
69
|
+
variant = 'glass',
|
|
70
|
+
size = 'md',
|
|
71
|
+
headingLevel = 'h3',
|
|
72
|
+
className = '',
|
|
73
|
+
} = Astro.props;
|
|
74
|
+
|
|
75
|
+
const Heading = headingLevel;
|
|
76
|
+
const money = { currency, locale };
|
|
77
|
+
const inStock = product.inStock !== false;
|
|
78
|
+
const cartPayload = JSON.stringify({
|
|
79
|
+
id: product.slug,
|
|
80
|
+
name: product.name,
|
|
81
|
+
price: product.price,
|
|
82
|
+
icon: product.icon,
|
|
83
|
+
hue: product.hue,
|
|
84
|
+
image: product.image,
|
|
85
|
+
variant: product.colors?.[0]?.name,
|
|
86
|
+
});
|
|
87
|
+
const titleId = `spc-${product.slug}`;
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
<article
|
|
91
|
+
class:list={['sp-card', `sp-card--${variant}`, `sp-card--${size}`, 'is-hoverable', className]}
|
|
92
|
+
aria-labelledby={titleId}
|
|
93
|
+
data-product
|
|
94
|
+
data-name={product.name.toLowerCase()}
|
|
95
|
+
data-category={product.category}
|
|
96
|
+
data-price={product.price}
|
|
97
|
+
data-rating={product.rating ?? 0}
|
|
98
|
+
data-colors={(product.colors ?? []).map((c) => c.name.toLowerCase()).join(',')}
|
|
99
|
+
data-stock={inStock ? 'in' : 'out'}
|
|
100
|
+
>
|
|
101
|
+
<div class="sp-card__media">
|
|
102
|
+
<ProductMedia image={product.image} alt={product.name} icon={product.icon} hue={product.hue} />
|
|
103
|
+
{product.badge && (
|
|
104
|
+
<div class="sp-card__badge"><Badge variant={product.badgeVariant ?? 'default'}>{product.badge}</Badge></div>
|
|
105
|
+
)}
|
|
106
|
+
<button class="sp-card__wish" type="button" aria-pressed="false" aria-label={`Save ${product.name} to wishlist`} data-wishlist>
|
|
107
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1 1.1L12 21l7.8-7.5 1-1.1a5.5 5.5 0 0 0 0-7.8z"/></svg>
|
|
108
|
+
</button>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="sp-card__body">
|
|
112
|
+
{categoryLabel && <p class="sp-card__cat">{categoryLabel}</p>}
|
|
113
|
+
<Heading class="sp-card__title" id={titleId}>
|
|
114
|
+
<a class="sp-card__link" href={href}>{product.name}</a>
|
|
115
|
+
</Heading>
|
|
116
|
+
{product.rating !== undefined && <ProductRating value={product.rating} count={product.reviews} />}
|
|
117
|
+
|
|
118
|
+
{product.colors && product.colors.length > 0 && (
|
|
119
|
+
<ul class="sp-card__swatches" aria-label={`Colours: ${product.colors.map((c) => c.name).join(', ')}`}>
|
|
120
|
+
{product.colors.slice(0, 4).map((c) => (
|
|
121
|
+
<li class="sp-card__swatch" style={`--sw: ${c.hex}`} title={c.name} />
|
|
122
|
+
))}
|
|
123
|
+
{product.colors.length > 4 && <li class="sp-card__swatch-more">+{product.colors.length - 4}</li>}
|
|
124
|
+
</ul>
|
|
125
|
+
)}
|
|
126
|
+
|
|
127
|
+
<div class="sp-card__foot">
|
|
128
|
+
<p class="sp-card__price">
|
|
129
|
+
<span class="sp-card__now">{formatMoney(product.price, money)}</span>
|
|
130
|
+
{product.compareAt && (
|
|
131
|
+
<s class="sp-card__was"><span class="sr-only">Was </span>{formatMoney(product.compareAt, money)}</s>
|
|
132
|
+
)}
|
|
133
|
+
</p>
|
|
134
|
+
<button
|
|
135
|
+
class="sp-card__add"
|
|
136
|
+
type="button"
|
|
137
|
+
data-add-to-cart={cartPayload}
|
|
138
|
+
data-cart-key={cartKey}
|
|
139
|
+
data-open-cart={openCart ? undefined : 'false'}
|
|
140
|
+
data-added-label={addedLabel}
|
|
141
|
+
disabled={!inStock}
|
|
142
|
+
aria-label={inStock ? `${ctaLabel}: ${product.name}` : `${product.name} is sold out`}
|
|
143
|
+
>
|
|
144
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6h15l-1.5 9h-12z"/><path d="M6 6 5 3H2"/><circle cx="9" cy="20" r="1.4"/><circle cx="18" cy="20" r="1.4"/></svg>
|
|
145
|
+
<span data-label>{inStock ? ctaLabel : 'Sold out'}</span>
|
|
146
|
+
</button>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</article>
|
|
150
|
+
|
|
151
|
+
<script>
|
|
152
|
+
import { bindAddToCart } from './cart-store';
|
|
153
|
+
|
|
154
|
+
function init() {
|
|
155
|
+
bindAddToCart(document);
|
|
156
|
+
document.querySelectorAll<HTMLButtonElement>('[data-wishlist]:not([data-wish-bound])').forEach((btn) => {
|
|
157
|
+
btn.dataset.wishBound = '';
|
|
158
|
+
btn.addEventListener('click', () => {
|
|
159
|
+
btn.setAttribute('aria-pressed', String(btn.getAttribute('aria-pressed') !== 'true'));
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
init();
|
|
164
|
+
document.addEventListener('astro:page-load', init);
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<style>
|
|
168
|
+
.sp-card {
|
|
169
|
+
container-type: inline-size;
|
|
170
|
+
position: relative;
|
|
171
|
+
display: flex;
|
|
172
|
+
flex-direction: column;
|
|
173
|
+
border-radius: var(--r-lg, 20px);
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
background: var(--c-surface, rgb(var(--ink-rgb, 255 255 255) / 0.02));
|
|
176
|
+
border: 1px solid var(--c-border, rgb(var(--ink-rgb, 255 255 255) / 0.05));
|
|
177
|
+
transition: border-color 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
|
|
178
|
+
}
|
|
179
|
+
.sp-card--glass {
|
|
180
|
+
background: linear-gradient(180deg, rgb(var(--ink-rgb, 255 255 255) / 0.035), rgb(var(--ink-rgb, 255 255 255) / 0.01));
|
|
181
|
+
backdrop-filter: blur(10px);
|
|
182
|
+
}
|
|
183
|
+
.sp-card--minimal { background: transparent; border-color: transparent; }
|
|
184
|
+
.sp-card--bordered { border-color: rgb(var(--ink-rgb, 255 255 255) / 0.12); }
|
|
185
|
+
.sp-card:hover {
|
|
186
|
+
border-color: rgba(212, 160, 23, 0.35);
|
|
187
|
+
transform: translateY(-3px);
|
|
188
|
+
box-shadow: 0 18px 40px -22px rgba(212, 160, 23, 0.45);
|
|
189
|
+
}
|
|
190
|
+
.sp-card:focus-within {
|
|
191
|
+
outline: 2px solid var(--c-primary-light, #d4a017);
|
|
192
|
+
outline-offset: 2px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.sp-card__media { position: relative; border-radius: var(--r-lg, 20px) var(--r-lg, 20px) 0 0; }
|
|
196
|
+
.sp-card--minimal .sp-card__media { border-radius: var(--r-lg, 20px); }
|
|
197
|
+
.sp-card__badge { position: absolute; top: var(--sp-3, 0.75rem); left: var(--sp-3, 0.75rem); z-index: 3; }
|
|
198
|
+
.sp-card__wish {
|
|
199
|
+
position: absolute;
|
|
200
|
+
top: var(--sp-2, 0.5rem);
|
|
201
|
+
right: var(--sp-2, 0.5rem);
|
|
202
|
+
z-index: 3;
|
|
203
|
+
display: grid;
|
|
204
|
+
place-items: center;
|
|
205
|
+
width: 44px;
|
|
206
|
+
height: 44px;
|
|
207
|
+
border-radius: var(--r-full, 9999px);
|
|
208
|
+
border: 1px solid rgb(var(--ink-rgb, 255 255 255) / 0.1);
|
|
209
|
+
background: rgb(var(--paper-rgb, 5 5 5) / 0.55);
|
|
210
|
+
backdrop-filter: blur(8px);
|
|
211
|
+
color: var(--c-text-1, #fff);
|
|
212
|
+
cursor: pointer;
|
|
213
|
+
transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
|
|
214
|
+
}
|
|
215
|
+
.sp-card__wish:hover { transform: scale(1.06); }
|
|
216
|
+
.sp-card__wish[aria-pressed='true'] { color: var(--c-danger, #f87171); }
|
|
217
|
+
.sp-card__wish[aria-pressed='true'] svg { fill: currentColor; }
|
|
218
|
+
.sp-card__wish:focus-visible,
|
|
219
|
+
.sp-card__add:focus-visible { outline: 2px solid var(--c-primary-light, #d4a017); outline-offset: 2px; }
|
|
220
|
+
|
|
221
|
+
.sp-card__body {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
gap: var(--sp-2, 0.5rem);
|
|
225
|
+
padding: var(--sp-4, 1rem) var(--sp-4, 1rem) var(--sp-5, 1.25rem);
|
|
226
|
+
flex: 1;
|
|
227
|
+
}
|
|
228
|
+
.sp-card--sm .sp-card__body { padding: var(--sp-3, 0.75rem); }
|
|
229
|
+
.sp-card--lg .sp-card__body { padding: var(--sp-6, 1.5rem); }
|
|
230
|
+
.sp-card--minimal .sp-card__body { padding-inline: 0; }
|
|
231
|
+
|
|
232
|
+
.sp-card__cat {
|
|
233
|
+
margin: 0;
|
|
234
|
+
font-size: 0.7rem;
|
|
235
|
+
font-weight: 700;
|
|
236
|
+
letter-spacing: 0.1em;
|
|
237
|
+
text-transform: uppercase;
|
|
238
|
+
color: var(--c-primary-light, #d4a017);
|
|
239
|
+
}
|
|
240
|
+
.sp-card__title { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.3; }
|
|
241
|
+
.sp-card--lg .sp-card__title { font-size: 1.15rem; }
|
|
242
|
+
.sp-card__link { color: var(--c-text-1, #fff); text-decoration: none; }
|
|
243
|
+
.sp-card__link:focus-visible { outline: none; }
|
|
244
|
+
.sp-card__link::after { content: ''; position: absolute; inset: 0; z-index: 2; }
|
|
245
|
+
|
|
246
|
+
.sp-card__swatches { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
|
|
247
|
+
.sp-card__swatch {
|
|
248
|
+
width: 14px;
|
|
249
|
+
height: 14px;
|
|
250
|
+
border-radius: 50%;
|
|
251
|
+
background: var(--sw);
|
|
252
|
+
box-shadow: 0 0 0 1px rgb(var(--ink-rgb, 255 255 255) / 0.25);
|
|
253
|
+
}
|
|
254
|
+
.sp-card__swatch-more { font-size: 0.72rem; color: var(--c-text-2, #a3a3a3); }
|
|
255
|
+
|
|
256
|
+
.sp-card__foot {
|
|
257
|
+
display: flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
justify-content: space-between;
|
|
260
|
+
gap: var(--sp-3, 0.75rem);
|
|
261
|
+
margin-top: auto;
|
|
262
|
+
padding-top: var(--sp-2, 0.5rem);
|
|
263
|
+
}
|
|
264
|
+
.sp-card__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--sp-2, 0.5rem); margin: 0; }
|
|
265
|
+
.sp-card__now { font-size: 1.1rem; font-weight: 800; color: var(--c-text-1, #fff); }
|
|
266
|
+
.sp-card__was { font-size: 0.82rem; color: var(--c-text-2, #a3a3a3); }
|
|
267
|
+
|
|
268
|
+
.sp-card__add {
|
|
269
|
+
position: relative;
|
|
270
|
+
z-index: 3;
|
|
271
|
+
display: inline-flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
gap: 0.4rem;
|
|
274
|
+
min-height: 44px;
|
|
275
|
+
padding: 0 var(--sp-4, 1rem);
|
|
276
|
+
border: 0;
|
|
277
|
+
border-radius: var(--r-full, 9999px);
|
|
278
|
+
background: var(--c-primary-light, #d4a017);
|
|
279
|
+
color: var(--c-on-primary, #050505);
|
|
280
|
+
font: inherit;
|
|
281
|
+
font-size: 0.82rem;
|
|
282
|
+
font-weight: 700;
|
|
283
|
+
white-space: nowrap;
|
|
284
|
+
cursor: pointer;
|
|
285
|
+
transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease;
|
|
286
|
+
}
|
|
287
|
+
.sp-card__add:hover { filter: brightness(1.08); transform: translateY(-1px); }
|
|
288
|
+
.sp-card__add:disabled { background: rgb(var(--ink-rgb, 255 255 255) / 0.08); color: var(--c-text-2, #a3a3a3); cursor: not-allowed; transform: none; }
|
|
289
|
+
.sp-card__add.is-added { background: var(--c-success, #34d399); }
|
|
290
|
+
.sp-card--sm .sp-card__add span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
|
|
291
|
+
.sp-card--sm .sp-card__add { width: 44px; padding: 0; justify-content: center; }
|
|
292
|
+
|
|
293
|
+
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
294
|
+
|
|
295
|
+
/* Narrow cards (2-up on phones): stack price above a full-width button */
|
|
296
|
+
@container (max-width: 250px) {
|
|
297
|
+
.sp-card__body { padding: var(--sp-3, 0.75rem) var(--sp-3, 0.75rem) var(--sp-4, 1rem); }
|
|
298
|
+
.sp-card__foot { flex-direction: column; align-items: stretch; gap: var(--sp-2, 0.5rem); }
|
|
299
|
+
.sp-card__add { justify-content: center; }
|
|
300
|
+
.sp-card__title { font-size: 0.92rem; }
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@media (prefers-reduced-motion: reduce) {
|
|
304
|
+
.sp-card, .sp-card__add, .sp-card__wish { transition: none; }
|
|
305
|
+
.sp-card:hover { transform: none; }
|
|
306
|
+
}
|
|
307
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* TrustBadges — Row of store guarantees (shipping, returns, secure payment, support).
|
|
4
|
+
*
|
|
5
|
+
* @param {Array<{icon: string, title: string, text?: string}>} items - Badges. Icons: truck|return|lock|chat|gift|leaf.
|
|
6
|
+
* @param {string} variant - Style (cards|inline|divided). Default 'cards'.
|
|
7
|
+
* @param {string} size - Density (sm|md|lg). Default 'md'.
|
|
8
|
+
* @param {string} className - Extra class.
|
|
9
|
+
*
|
|
10
|
+
* Accessibility: plain list; icons are decorative.
|
|
11
|
+
*/
|
|
12
|
+
interface Item { icon: 'truck' | 'return' | 'lock' | 'chat' | 'gift' | 'leaf'; title: string; text?: string }
|
|
13
|
+
interface Props {
|
|
14
|
+
items?: Item[];
|
|
15
|
+
variant?: 'cards' | 'inline' | 'divided';
|
|
16
|
+
size?: 'sm' | 'md' | 'lg';
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
items = [
|
|
22
|
+
{ icon: 'truck', title: 'Free shipping', text: 'On orders over $75' },
|
|
23
|
+
{ icon: 'return', title: '30-day returns', text: 'No questions asked' },
|
|
24
|
+
{ icon: 'lock', title: 'Secure checkout', text: 'SSL & 3-D Secure' },
|
|
25
|
+
{ icon: 'chat', title: 'Real humans', text: 'Support 7 days a week' },
|
|
26
|
+
],
|
|
27
|
+
variant = 'cards',
|
|
28
|
+
size = 'md',
|
|
29
|
+
className = '',
|
|
30
|
+
} = Astro.props;
|
|
31
|
+
|
|
32
|
+
const icons: Record<Item['icon'], string> = {
|
|
33
|
+
truck: '<path d="M3 6h11v10H3zM14 10h4l3 3v3h-7"/><circle cx="7" cy="18" r="2"/><circle cx="17" cy="18" r="2"/>',
|
|
34
|
+
return: '<path d="M4 10h11a5 5 0 0 1 0 10H9"/><path d="m8 6-4 4 4 4"/>',
|
|
35
|
+
lock: '<rect x="4" y="11" width="16" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',
|
|
36
|
+
chat: '<path d="M21 12a8 8 0 0 1-11.6 7.1L4 20l1.1-4.6A8 8 0 1 1 21 12z"/>',
|
|
37
|
+
gift: '<rect x="3" y="8" width="18" height="5" rx="1"/><path d="M5 13v8h14v-8M12 8v13M12 8S10 3 7.5 4 9 8 12 8zm0 0s2-5 4.5-4S15 8 12 8z"/>',
|
|
38
|
+
leaf: '<path d="M5 19c0-9 6-14 15-14 0 9-5 15-14 15"/><path d="M5 19c3-4 6-6 10-8"/>',
|
|
39
|
+
};
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
<div class="trust-badges-cq">
|
|
43
|
+
<ul class:list={['trust-badges', `trust-badges--${variant}`, `trust-badges--${size}`, className]}>
|
|
44
|
+
{items.map((item) => (
|
|
45
|
+
<li class="trust-badge">
|
|
46
|
+
<span class="trust-badge__icon" aria-hidden="true">
|
|
47
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><Fragment set:html={icons[item.icon]} /></svg>
|
|
48
|
+
</span>
|
|
49
|
+
<span class="trust-badge__text">
|
|
50
|
+
<strong>{item.title}</strong>
|
|
51
|
+
{item.text && <span>{item.text}</span>}
|
|
52
|
+
</span>
|
|
53
|
+
</li>
|
|
54
|
+
))}
|
|
55
|
+
</ul>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
.trust-badges-cq { container-type: inline-size; }
|
|
60
|
+
.trust-badges {
|
|
61
|
+
display: grid;
|
|
62
|
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
63
|
+
gap: var(--sp-4, 1rem);
|
|
64
|
+
margin: 0;
|
|
65
|
+
padding: 0;
|
|
66
|
+
list-style: none;
|
|
67
|
+
}
|
|
68
|
+
.trust-badge { display: flex; align-items: center; gap: var(--sp-3, 0.75rem); }
|
|
69
|
+
.trust-badges--cards .trust-badge {
|
|
70
|
+
padding: var(--sp-4, 1rem) var(--sp-5, 1.25rem);
|
|
71
|
+
border-radius: var(--r-md, 12px);
|
|
72
|
+
border: 1px solid var(--c-border, rgb(var(--ink-rgb, 255 255 255) / 0.05));
|
|
73
|
+
background: var(--c-surface, rgb(var(--ink-rgb, 255 255 255) / 0.02));
|
|
74
|
+
}
|
|
75
|
+
.trust-badges--divided { gap: 0; border-block: 1px solid var(--c-border, rgb(var(--ink-rgb, 255 255 255) / 0.05)); }
|
|
76
|
+
.trust-badges--divided .trust-badge { padding: var(--sp-5, 1.25rem); }
|
|
77
|
+
.trust-badges--divided .trust-badge + .trust-badge { border-left: 1px solid var(--c-border, rgb(var(--ink-rgb, 255 255 255) / 0.05)); }
|
|
78
|
+
.trust-badges--sm .trust-badge { padding-block: var(--sp-3, 0.75rem); }
|
|
79
|
+
.trust-badges--lg .trust-badge { padding-block: var(--sp-6, 1.5rem); }
|
|
80
|
+
|
|
81
|
+
.trust-badge__icon {
|
|
82
|
+
display: grid;
|
|
83
|
+
place-items: center;
|
|
84
|
+
flex-shrink: 0;
|
|
85
|
+
width: 44px;
|
|
86
|
+
height: 44px;
|
|
87
|
+
border-radius: var(--r-sm, 8px);
|
|
88
|
+
background: rgba(212, 160, 23, 0.1);
|
|
89
|
+
color: var(--c-primary-light, #d4a017);
|
|
90
|
+
}
|
|
91
|
+
.trust-badges--inline .trust-badge__icon { width: 32px; height: 32px; background: transparent; }
|
|
92
|
+
.trust-badge__text { display: grid; gap: 1px; }
|
|
93
|
+
.trust-badge__text strong { font-size: 0.92rem; color: var(--c-text-1, #fff); }
|
|
94
|
+
.trust-badge__text span { font-size: 0.8rem; color: var(--c-text-2, #a3a3a3); }
|
|
95
|
+
|
|
96
|
+
@container (max-width: 640px) {
|
|
97
|
+
.trust-badges { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2, 0.5rem); }
|
|
98
|
+
.trust-badges--divided .trust-badge + .trust-badge { border-left: 0; }
|
|
99
|
+
.trust-badge { flex-direction: column; align-items: flex-start; }
|
|
100
|
+
}
|
|
101
|
+
</style>
|