@thorprovider/create-storefront 0.1.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 +119 -0
- package/bin/install.js +116 -0
- package/commands/sf-add-view.md +21 -0
- package/commands/sf-init.md +16 -0
- package/commands/sf-theme.md +15 -0
- package/commands/sf-view.md +20 -0
- package/package.json +40 -0
- package/recipes/archetype.schema.json +39 -0
- package/recipes/archetypes.json +148 -0
- package/recipes/recipe.schema.json +59 -0
- package/recipes/recipes.json +90 -0
- package/recipes/sections.json +46 -0
- package/recipes/validate.mjs +190 -0
- package/skills/building-storefronts/SKILL.md +178 -0
- package/skills/building-storefronts/references/frontend-integration.md +229 -0
- package/skills/json-render-core/SKILL.md +291 -0
- package/skills/json-render-next/SKILL.md +194 -0
- package/skills/json-render-react/SKILL.md +298 -0
- package/skills/json-render-remotion/SKILL.md +111 -0
- package/skills/json-render-shadcn/SKILL.md +159 -0
- package/skills/json-render-solid/SKILL.md +204 -0
- package/skills/nextjs-shadcn/SKILL.md +303 -0
- package/skills/nextjs-shadcn/references/architecture.md +499 -0
- package/skills/nextjs-shadcn/references/project-setup.md +127 -0
- package/skills/nextjs-shadcn/references/shadcn-platform.md +258 -0
- package/skills/nextjs-shadcn/references/sidebar.md +274 -0
- package/skills/nextjs-shadcn/references/styling.md +555 -0
- package/skills/sf-scaffold/SKILL.md +118 -0
- package/skills/sf-theme-gen/SKILL.md +44 -0
- package/skills/sf-view-gen/SKILL.md +94 -0
- package/skills/shadcn-component-discovery/SKILL.md +273 -0
- package/skills/shadcn-component-discovery/references/registries.md +226 -0
- package/skills/shadcn-theming/SKILL.md +104 -0
- package/skills/shadcn-theming/references/templates/theme-setup.md +109 -0
- package/skills/shadcn-theming/references/theming-guide.md +90 -0
- package/skills/storefront-best-practices/SKILL.md +421 -0
- package/skills/storefront-best-practices/reference/components/breadcrumbs.md +123 -0
- package/skills/storefront-best-practices/reference/components/cart-popup.md +189 -0
- package/skills/storefront-best-practices/reference/components/country-selector.md +298 -0
- package/skills/storefront-best-practices/reference/components/footer.md +112 -0
- package/skills/storefront-best-practices/reference/components/hero.md +241 -0
- package/skills/storefront-best-practices/reference/components/megamenu.md +239 -0
- package/skills/storefront-best-practices/reference/components/navbar.md +397 -0
- package/skills/storefront-best-practices/reference/components/popups.md +221 -0
- package/skills/storefront-best-practices/reference/components/product-card.md +125 -0
- package/skills/storefront-best-practices/reference/components/product-reviews.md +217 -0
- package/skills/storefront-best-practices/reference/components/product-slider.md +174 -0
- package/skills/storefront-best-practices/reference/components/search.md +101 -0
- package/skills/storefront-best-practices/reference/connecting-to-backend.md +391 -0
- package/skills/storefront-best-practices/reference/design.md +388 -0
- package/skills/storefront-best-practices/reference/features/promotions.md +307 -0
- package/skills/storefront-best-practices/reference/features/wishlist.md +230 -0
- package/skills/storefront-best-practices/reference/layouts/account.md +380 -0
- package/skills/storefront-best-practices/reference/layouts/cart.md +316 -0
- package/skills/storefront-best-practices/reference/layouts/checkout.md +486 -0
- package/skills/storefront-best-practices/reference/layouts/home-page.md +264 -0
- package/skills/storefront-best-practices/reference/layouts/order-confirmation.md +231 -0
- package/skills/storefront-best-practices/reference/layouts/product-details.md +527 -0
- package/skills/storefront-best-practices/reference/layouts/product-listing.md +520 -0
- package/skills/storefront-best-practices/reference/layouts/static-pages.md +356 -0
- package/skills/storefront-best-practices/reference/medusa.md +307 -0
- package/skills/storefront-best-practices/reference/mobile-responsiveness.md +183 -0
- package/skills/storefront-best-practices/reference/seo.md +195 -0
- package/templates/app/app/[[...slug]]/page.tsx +17 -0
- package/templates/app/app/[[...slug]]/renderer.tsx +10 -0
- package/templates/app/app/globals.css +101 -0
- package/templates/app/app/layout.tsx +35 -0
- package/templates/app/lib/__STOREFRONT__/catalog.ts +132 -0
- package/templates/app/lib/__STOREFRONT__/handlers.ts +33 -0
- package/templates/app/lib/__STOREFRONT__/registry.tsx +134 -0
- package/templates/app/lib/__STOREFRONT__/runtime.ts +25 -0
- package/templates/app/lib/__STOREFRONT__/spec/home.ts +62 -0
- package/templates/app/lib/__STOREFRONT__/spec/index.ts +59 -0
- package/templates/app/lib/__STOREFRONT__/spec/types.ts +14 -0
- package/templates/app/lib/__STOREFRONT__/state.ts +35 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Product Card Component
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- [Overview](#overview)
|
|
6
|
+
- [Price Display (Ecommerce-Specific)](#price-display-ecommerce-specific)
|
|
7
|
+
- [Action Buttons and Variant Handling](#action-buttons-and-variant-handling)
|
|
8
|
+
- [Badges and Labels](#badges-and-labels)
|
|
9
|
+
- [Mobile Considerations](#mobile-considerations)
|
|
10
|
+
- [Ecommerce Checklist](#ecommerce-checklist)
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
Product cards display products in grids (product listings, search results, related products). Key ecommerce considerations: clear pricing, quick add-to-cart, and stock indicators.
|
|
15
|
+
|
|
16
|
+
**Assumed knowledge**: AI agents know how to build cards with images, titles, and buttons. This guide focuses on ecommerce-specific patterns.
|
|
17
|
+
|
|
18
|
+
### Key Ecommerce Requirements
|
|
19
|
+
|
|
20
|
+
- Clear, prominent pricing (including sale prices)
|
|
21
|
+
- Variant handling for add-to-cart
|
|
22
|
+
- Stock status indicators
|
|
23
|
+
- Sale/New/Out of Stock badges
|
|
24
|
+
- Responsive grid (1 col mobile, 2-3 tablet, 3-4 desktop)
|
|
25
|
+
- Fast image loading (lazy load, optimized)
|
|
26
|
+
|
|
27
|
+
## Price Display (Ecommerce-Specific)
|
|
28
|
+
|
|
29
|
+
### Regular vs Sale Pricing
|
|
30
|
+
|
|
31
|
+
**Sale price display:**
|
|
32
|
+
- Sale price: Larger, bold, red or accent color
|
|
33
|
+
- Original price: Smaller, struck through (~~$79.99~~), gray
|
|
34
|
+
- Position sale price before original price
|
|
35
|
+
- Optional: Show discount percentage badge (-20%)
|
|
36
|
+
|
|
37
|
+
**Format consistently:**
|
|
38
|
+
- Always include currency symbol ($49.99)
|
|
39
|
+
- Consistent decimals ($49.99 not $49.9 or $50)
|
|
40
|
+
- For Medusa: Display prices as-is (no divide by 100)
|
|
41
|
+
|
|
42
|
+
### Price Range (Multiple Variants)
|
|
43
|
+
|
|
44
|
+
**When variants have different prices:**
|
|
45
|
+
- Show "From $49" or "$49 - $79"
|
|
46
|
+
- Makes it clear price varies by selection
|
|
47
|
+
- Don't show range if all variants same price
|
|
48
|
+
|
|
49
|
+
## Action Buttons and Variant Handling
|
|
50
|
+
|
|
51
|
+
### Add to Cart with Variants (CRITICAL)
|
|
52
|
+
|
|
53
|
+
**Key challenge**: Products with variants require variant selection before adding to cart.
|
|
54
|
+
|
|
55
|
+
**Handling strategies:**
|
|
56
|
+
|
|
57
|
+
1. **Add first variant by default** - Click adds `product.variants[0]`. Fast for simple products (1-2 variants).
|
|
58
|
+
2. **Redirect to product page** - Navigate to detail page for variant selection. Best for complex products (size + color + material).
|
|
59
|
+
3. **Quick View modal** - Variant selector in modal. Good middle ground (desktop only).
|
|
60
|
+
|
|
61
|
+
**Decision:**
|
|
62
|
+
- Simple products (1-2 variants): Add first variant
|
|
63
|
+
- Fashion/apparel with sizes: Require size selection (redirect or Quick View)
|
|
64
|
+
- Complex products (3+ variant types): Redirect to product page
|
|
65
|
+
|
|
66
|
+
**Button behavior:**
|
|
67
|
+
- Loading state ("Adding..."), disable during loading
|
|
68
|
+
- Optimistic UI update (cart count immediately)
|
|
69
|
+
- Success feedback (toast, cart popup, or checkmark)
|
|
70
|
+
- **Don't navigate away** (stay on listing page)
|
|
71
|
+
- Handle errors (out of stock, API failure)
|
|
72
|
+
|
|
73
|
+
**Wishlist button (optional)**: Heart icon, top-right over image. Empty when not saved, filled (red) when saved. Refer to wishlist.md for more details.
|
|
74
|
+
|
|
75
|
+
## Badges and Labels
|
|
76
|
+
|
|
77
|
+
**Badge priority** (show max 1-2 per card):
|
|
78
|
+
|
|
79
|
+
1. **Out of Stock** (highest) - Gray/black overlay on image, disables add-to-cart
|
|
80
|
+
2. **Sale/Discount** - "Sale" or "-20%", red/accent, top-left corner
|
|
81
|
+
3. **New** - "New" for recent products, blue/green, top-left corner
|
|
82
|
+
4. **Low Stock** (optional) - "Only 3 left", orange, creates urgency
|
|
83
|
+
|
|
84
|
+
**Display**: Top-left corner (except Out of Stock overlay), small but readable, high contrast.
|
|
85
|
+
|
|
86
|
+
## Mobile Considerations
|
|
87
|
+
|
|
88
|
+
### Grid Layout
|
|
89
|
+
|
|
90
|
+
**Mobile-specific adjustments:**
|
|
91
|
+
- 2 columns maximum on mobile (never 3+)
|
|
92
|
+
- Larger touch targets (44px minimum for buttons)
|
|
93
|
+
- Always show "Add to Cart" button (no hover-only)
|
|
94
|
+
- Simplified content (hide optional elements like brand)
|
|
95
|
+
- Smaller images for performance (<400px wide)
|
|
96
|
+
|
|
97
|
+
### Touch Interactions
|
|
98
|
+
|
|
99
|
+
**No hover states on mobile:**
|
|
100
|
+
- Don't hide actions behind hover
|
|
101
|
+
- Always show primary button
|
|
102
|
+
- Use tap states (active state) instead of hover
|
|
103
|
+
|
|
104
|
+
## Ecommerce Checklist
|
|
105
|
+
|
|
106
|
+
**Essential features:**
|
|
107
|
+
|
|
108
|
+
- [ ] Clear product image (optimized, lazy loaded)
|
|
109
|
+
- [ ] Product title (truncated to 2 lines max)
|
|
110
|
+
- [ ] Price prominently displayed
|
|
111
|
+
- [ ] Sale price shown correctly (struck-through original price)
|
|
112
|
+
- [ ] Currency symbol included
|
|
113
|
+
- [ ] For Medusa: Price displayed as-is (not divided by 100)
|
|
114
|
+
- [ ] Add to Cart button with loading state
|
|
115
|
+
- [ ] Variant handling strategy (first variant, redirect, or Quick View)
|
|
116
|
+
- [ ] Optimistic UI update (cart count immediately)
|
|
117
|
+
- [ ] Success feedback (toast or cart popup)
|
|
118
|
+
- [ ] Don't navigate away after adding to cart
|
|
119
|
+
- [ ] Out of Stock badge (disables add-to-cart)
|
|
120
|
+
- [ ] Sale badge when price reduced
|
|
121
|
+
- [ ] Responsive grid (1 col mobile, 2-3 tablet, 3-4 desktop)
|
|
122
|
+
- [ ] Touch-friendly on mobile (44px buttons)
|
|
123
|
+
- [ ] Keyboard accessible (focus states, Enter to activate)
|
|
124
|
+
- [ ] Descriptive alt text on images
|
|
125
|
+
- [ ] Semantic HTML (`<article>` wrapper)
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Product Reviews Component
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- [Overview](#overview)
|
|
6
|
+
- [Review Display Patterns](#review-display-patterns)
|
|
7
|
+
- [Rating Summary and Distribution](#rating-summary-and-distribution)
|
|
8
|
+
- [Sorting and Filtering](#sorting-and-filtering)
|
|
9
|
+
- [Review Submission](#review-submission)
|
|
10
|
+
- [Trust Signals](#trust-signals)
|
|
11
|
+
- [SEO Integration](#seo-integration)
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Product reviews build trust and influence purchase decisions. Reviews with ratings convert 270% better than products without.
|
|
16
|
+
|
|
17
|
+
**Assumed knowledge**: Claude knows how to build forms and display lists. This guide focuses on ecommerce review patterns and trust signals.
|
|
18
|
+
|
|
19
|
+
### Key Requirements
|
|
20
|
+
|
|
21
|
+
- Star rating summary (1-5 stars) with distribution
|
|
22
|
+
- Individual reviews with ratings, text, author, date
|
|
23
|
+
- Sorting (Most Recent, Most Helpful, Highest/Lowest Rating)
|
|
24
|
+
- Filtering by rating (5 stars only, 4+ stars)
|
|
25
|
+
- Verified purchase badges
|
|
26
|
+
- Helpful votes (upvote system)
|
|
27
|
+
- Review submission form
|
|
28
|
+
- Mobile-optimized
|
|
29
|
+
|
|
30
|
+
## Review Display Patterns
|
|
31
|
+
|
|
32
|
+
### Placement
|
|
33
|
+
|
|
34
|
+
**On product page:**
|
|
35
|
+
- Below product details (after add-to-cart)
|
|
36
|
+
- Before related products
|
|
37
|
+
- Anchor link in product info: "★★★★★ (127 reviews)"
|
|
38
|
+
|
|
39
|
+
**Separate reviews page:**
|
|
40
|
+
- Only for very large catalogs (500+ reviews)
|
|
41
|
+
- Link: "View All Reviews"
|
|
42
|
+
- Most stores show reviews inline on product page
|
|
43
|
+
|
|
44
|
+
## Rating Summary and Distribution
|
|
45
|
+
|
|
46
|
+
### Average Rating Display
|
|
47
|
+
|
|
48
|
+
**Show prominently:**
|
|
49
|
+
- Average rating: "★★★★★ 4.5 out of 5"
|
|
50
|
+
- Total review count: "Based on 127 reviews"
|
|
51
|
+
- Large stars (24-32px)
|
|
52
|
+
|
|
53
|
+
### Rating Distribution (CRITICAL)
|
|
54
|
+
|
|
55
|
+
**Visual breakdown with clickable bars:**
|
|
56
|
+
```
|
|
57
|
+
5 ★ [████████████████████] 82 (65%)
|
|
58
|
+
4 ★ [██████░░░░░░░░░░░░░░] 25 (20%)
|
|
59
|
+
3 ★ [██░░░░░░░░░░░░░░░░░░] 10 (8%)
|
|
60
|
+
2 ★ [█░░░░░░░░░░░░░░░░░░░] 5 (4%)
|
|
61
|
+
1 ★ [█░░░░░░░░░░░░░░░░░░░] 5 (3%)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Make bars clickable:**
|
|
65
|
+
- Click to filter reviews by rating
|
|
66
|
+
- Shows only selected star ratings
|
|
67
|
+
- "Show all" to reset filter
|
|
68
|
+
|
|
69
|
+
**Why distribution matters:**
|
|
70
|
+
- Perfect 5.0 rating seems fake (customers trust 4.2-4.5 average)
|
|
71
|
+
- Showing negative reviews builds trust
|
|
72
|
+
- Distribution helps customers understand product quality
|
|
73
|
+
|
|
74
|
+
### No Reviews State
|
|
75
|
+
|
|
76
|
+
**When no reviews:**
|
|
77
|
+
- "No reviews yet"
|
|
78
|
+
- "Be the first to review this product"
|
|
79
|
+
- "Write a Review" button prominent
|
|
80
|
+
- Don't show 0 stars or empty rating
|
|
81
|
+
|
|
82
|
+
## Sorting and Filtering
|
|
83
|
+
|
|
84
|
+
### Sort Options (CRITICAL)
|
|
85
|
+
|
|
86
|
+
**Essential sorting:**
|
|
87
|
+
- **Most Recent** (default) - shows latest feedback
|
|
88
|
+
- **Most Helpful** (by upvotes) - surfaces best reviews
|
|
89
|
+
- **Highest Rating** (5 stars first) - see positive feedback
|
|
90
|
+
- **Lowest Rating** (1 star first) - see concerns
|
|
91
|
+
|
|
92
|
+
**Dropdown selector:**
|
|
93
|
+
```
|
|
94
|
+
Sort by: [Most Recent ▾]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Filter Options
|
|
98
|
+
|
|
99
|
+
**Filter by rating:**
|
|
100
|
+
- All ratings (default)
|
|
101
|
+
- 5 stars only
|
|
102
|
+
- 4+ stars
|
|
103
|
+
- 3 stars or less (see negative feedback)
|
|
104
|
+
|
|
105
|
+
**Filter by criteria:**
|
|
106
|
+
- Verified purchases only (highest trust)
|
|
107
|
+
- With photos only (visual proof)
|
|
108
|
+
- Recent (last 30 days, 6 months)
|
|
109
|
+
|
|
110
|
+
**Show filtered count:**
|
|
111
|
+
- "Showing 24 of 127 reviews"
|
|
112
|
+
|
|
113
|
+
## Review Submission
|
|
114
|
+
|
|
115
|
+
### Review Form Fields
|
|
116
|
+
|
|
117
|
+
**Required:**
|
|
118
|
+
- Star rating (1-5 stars selector)
|
|
119
|
+
- Review text (textarea, 50-500 characters)
|
|
120
|
+
- Reviewer name (if not logged in)
|
|
121
|
+
|
|
122
|
+
**Optional:**
|
|
123
|
+
- Review title/headline
|
|
124
|
+
- Upload images (2-5 max)
|
|
125
|
+
- Would you recommend? (Yes/No)
|
|
126
|
+
|
|
127
|
+
**Form placement:**
|
|
128
|
+
- "Write a Review" button opens modal or inline form
|
|
129
|
+
- Position near rating summary
|
|
130
|
+
|
|
131
|
+
### Form Validation
|
|
132
|
+
|
|
133
|
+
**Requirements:**
|
|
134
|
+
- Rating must be selected
|
|
135
|
+
- Minimum review length (50 characters)
|
|
136
|
+
- Show character counter: "50 / 500 characters"
|
|
137
|
+
- Validate before submit
|
|
138
|
+
|
|
139
|
+
**Success:**
|
|
140
|
+
- "Thank you for your review!"
|
|
141
|
+
- "Your review is pending approval" (if moderation enabled)
|
|
142
|
+
|
|
143
|
+
## Trust Signals
|
|
144
|
+
|
|
145
|
+
### Verified Purchase Badge (CRITICAL)
|
|
146
|
+
|
|
147
|
+
**Display:**
|
|
148
|
+
- Badge or checkmark: "✓ Verified Purchase"
|
|
149
|
+
- Position near reviewer name
|
|
150
|
+
- Green color or checkmark icon
|
|
151
|
+
- Only for confirmed customers
|
|
152
|
+
|
|
153
|
+
**Why it matters:**
|
|
154
|
+
- Builds trust (real customer, not fake)
|
|
155
|
+
- Reduces suspicion of paid reviews
|
|
156
|
+
- Higher credibility
|
|
157
|
+
|
|
158
|
+
### Helpful Votes
|
|
159
|
+
|
|
160
|
+
**Upvote/downvote system:**
|
|
161
|
+
- "Was this review helpful?"
|
|
162
|
+
- [👍 Yes (24)] [👎 No (2)]
|
|
163
|
+
- Click to vote (one vote per user)
|
|
164
|
+
- Powers "Most Helpful" sorting
|
|
165
|
+
|
|
166
|
+
**Benefits:**
|
|
167
|
+
- Surfaces most useful reviews
|
|
168
|
+
- Community validation
|
|
169
|
+
- Reduces impact of unhelpful reviews
|
|
170
|
+
|
|
171
|
+
### Review Images (Optional)
|
|
172
|
+
|
|
173
|
+
Customer-uploaded photos (3-4 max per review, 60-80px thumbnails, click to enlarge). Visual proof increases trust and engagement.
|
|
174
|
+
|
|
175
|
+
### Store Responses (Recommended)
|
|
176
|
+
|
|
177
|
+
Seller replies below original review (indented, light gray background). Respond to negative reviews professionally - shows you care, addresses concerns without being defensive.
|
|
178
|
+
|
|
179
|
+
## SEO Integration
|
|
180
|
+
|
|
181
|
+
**AggregateRating Schema (CRITICAL):** Add structured data to show star ratings in search results. Include `ratingValue` (avg rating), `reviewCount`, `bestRating` (5), `worstRating` (1).
|
|
182
|
+
|
|
183
|
+
**SEO benefits:** Star ratings in search results, higher CTR, rich snippets. See seo.md for implementation details.
|
|
184
|
+
|
|
185
|
+
**Important:** Only include if reviews are real. Fake reviews violate Google guidelines.
|
|
186
|
+
|
|
187
|
+
## Display Patterns
|
|
188
|
+
|
|
189
|
+
**Individual review card:**
|
|
190
|
+
Star rating (16-20px) + text + reviewer name (first name + initial) + date + verified badge + helpful votes. Truncate long reviews (200-300 chars) with "Read more".
|
|
191
|
+
|
|
192
|
+
**Mobile:**
|
|
193
|
+
Single column, touch-friendly votes (44px), full-screen sort select, filter bottom sheet, "Load more" pagination.
|
|
194
|
+
|
|
195
|
+
## Checklist
|
|
196
|
+
|
|
197
|
+
**Essential features:**
|
|
198
|
+
|
|
199
|
+
- [ ] Star rating summary (average + count)
|
|
200
|
+
- [ ] Rating distribution bar chart (5 to 1 stars)
|
|
201
|
+
- [ ] Clickable bars to filter by rating
|
|
202
|
+
- [ ] Sort dropdown (Most Recent, Most Helpful, Highest/Lowest)
|
|
203
|
+
- [ ] Filter options (verified, with photos, by rating)
|
|
204
|
+
- [ ] Individual reviews with: stars, text, name, date
|
|
205
|
+
- [ ] Verified purchase badge
|
|
206
|
+
- [ ] Helpful votes (upvote/downvote)
|
|
207
|
+
- [ ] Review submission form (rating, text)
|
|
208
|
+
- [ ] Form validation (minimum length, required rating)
|
|
209
|
+
- [ ] "Read more" for long reviews
|
|
210
|
+
- [ ] Store responses to reviews (recommended)
|
|
211
|
+
- [ ] Review images (customer uploads, optional)
|
|
212
|
+
- [ ] Mobile: Touch targets 44px minimum
|
|
213
|
+
- [ ] Pagination or "Load more" button
|
|
214
|
+
- [ ] No reviews state ("Be the first to review")
|
|
215
|
+
- [ ] AggregateRating structured data (SEO)
|
|
216
|
+
- [ ] ARIA labels for star ratings
|
|
217
|
+
- [ ] Keyboard accessible (all interactions)
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Product Slider Component
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- [Overview](#overview)
|
|
6
|
+
- [When to Use Product Sliders](#when-to-use-product-sliders)
|
|
7
|
+
- [Slider Patterns](#slider-patterns)
|
|
8
|
+
- [Product Display](#product-display)
|
|
9
|
+
- [Navigation Controls](#navigation-controls)
|
|
10
|
+
- [Mobile Sliders](#mobile-sliders)
|
|
11
|
+
- [Performance](#performance)
|
|
12
|
+
- [Checklist](#checklist)
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Product slider (carousel) displays multiple products horizontally with navigation to scroll through them. Used for related products, recently viewed, bestsellers, and featured products.
|
|
17
|
+
|
|
18
|
+
**Assumed knowledge**: AI agents know how to build carousels with navigation. This focuses on ecommerce product slider patterns.
|
|
19
|
+
|
|
20
|
+
**Key requirements:**
|
|
21
|
+
- Horizontal scrolling of product cards
|
|
22
|
+
- Arrow navigation (prev/next)
|
|
23
|
+
- Optional dot indicators
|
|
24
|
+
- Mobile: Swipe gesture support
|
|
25
|
+
- Responsive product count (4-6 visible desktop, 2-3 mobile)
|
|
26
|
+
- Lazy loading for off-screen products
|
|
27
|
+
|
|
28
|
+
## When to Use Product Sliders
|
|
29
|
+
|
|
30
|
+
**Use for:**
|
|
31
|
+
- Related products (product page)
|
|
32
|
+
- Recently viewed (product page, homepage)
|
|
33
|
+
- "You May Also Like" (product page)
|
|
34
|
+
- Bestsellers / Featured products (homepage)
|
|
35
|
+
- "Frequently Bought Together" (product page)
|
|
36
|
+
- New arrivals (homepage)
|
|
37
|
+
- Category showcases (homepage)
|
|
38
|
+
|
|
39
|
+
**Don't use for:**
|
|
40
|
+
- Main product images (use gallery instead)
|
|
41
|
+
- Critical content (not all users scroll/swipe)
|
|
42
|
+
- Checkout flow (keep linear)
|
|
43
|
+
- Primary navigation (use grid for discoverability)
|
|
44
|
+
|
|
45
|
+
## Slider Patterns
|
|
46
|
+
|
|
47
|
+
**Continuous scroll:**
|
|
48
|
+
- Shows 4-6 products at once (desktop)
|
|
49
|
+
- Scroll left/right by 1-2 products at a time
|
|
50
|
+
- Smooth animated transition (300-400ms)
|
|
51
|
+
- Most common pattern
|
|
52
|
+
|
|
53
|
+
**Infinite loop (optional):**
|
|
54
|
+
- Wraps to beginning after end
|
|
55
|
+
- Good for small product sets (<10 items)
|
|
56
|
+
- Creates continuous browsing feel
|
|
57
|
+
- Not necessary for large sets
|
|
58
|
+
|
|
59
|
+
**Snap to alignment:**
|
|
60
|
+
- Products snap to grid after scroll
|
|
61
|
+
- Prevents partial product visibility
|
|
62
|
+
- Better visual alignment
|
|
63
|
+
- Improves browsing experience
|
|
64
|
+
|
|
65
|
+
**Auto-play (NOT recommended for products):**
|
|
66
|
+
- Automatic scrolling without user action
|
|
67
|
+
- Poor UX for product sliders (users lose control)
|
|
68
|
+
- Only use for promotional banners/hero images
|
|
69
|
+
- If using: Pause on hover, slow speed (5-7s)
|
|
70
|
+
|
|
71
|
+
## Product Display
|
|
72
|
+
|
|
73
|
+
**Product cards in sliders:**
|
|
74
|
+
- Same cards as product grids (see product-card.md)
|
|
75
|
+
- Simplified on mobile (less detail, smaller images)
|
|
76
|
+
- Image, title, price minimum
|
|
77
|
+
- Optional: Rating, "Add to Cart" (desktop only)
|
|
78
|
+
- Adequate spacing between cards (16-24px)
|
|
79
|
+
|
|
80
|
+
**Responsive display:**
|
|
81
|
+
- Large desktop (>1440px): 5-6 products visible
|
|
82
|
+
- Desktop (1024-1440px): 4-5 products
|
|
83
|
+
- Tablet (768-1024px): 3-4 products
|
|
84
|
+
- Mobile (<768px): 2 products (sometimes 1.5 for scroll hint)
|
|
85
|
+
|
|
86
|
+
**Scroll hint on mobile:**
|
|
87
|
+
- Show 1.5 products (partial visibility of next)
|
|
88
|
+
- Indicates more content to swipe
|
|
89
|
+
- Improves discoverability
|
|
90
|
+
- Better than showing exact 2 products
|
|
91
|
+
|
|
92
|
+
## Navigation Controls
|
|
93
|
+
|
|
94
|
+
**Arrow buttons:**
|
|
95
|
+
- Left/right arrows outside slider
|
|
96
|
+
- Desktop: Always visible or show on hover
|
|
97
|
+
- Mobile: Hidden (swipe gesture preferred)
|
|
98
|
+
- Position: Vertically centered
|
|
99
|
+
- Size: 40-48px touch targets
|
|
100
|
+
- Disable left arrow at start, right arrow at end (no infinite loop)
|
|
101
|
+
|
|
102
|
+
**Dot indicators (optional):**
|
|
103
|
+
- Show progress through slider
|
|
104
|
+
- Each dot = one "page" of products
|
|
105
|
+
- Position: Below slider, centered
|
|
106
|
+
- Small (8-12px dots)
|
|
107
|
+
- Only if many products (>12)
|
|
108
|
+
- Less common for product sliders (more for hero carousels)
|
|
109
|
+
|
|
110
|
+
**Keyboard navigation:**
|
|
111
|
+
- Tab through visible product cards
|
|
112
|
+
- Arrow keys scroll slider (optional)
|
|
113
|
+
- Focus management on scroll
|
|
114
|
+
|
|
115
|
+
## Mobile Sliders
|
|
116
|
+
|
|
117
|
+
**Touch gestures:**
|
|
118
|
+
- Horizontal swipe to scroll
|
|
119
|
+
- Native scroll momentum
|
|
120
|
+
- Snap to product alignment
|
|
121
|
+
- No arrow buttons (swipe is intuitive)
|
|
122
|
+
|
|
123
|
+
**Mobile-specific adjustments:**
|
|
124
|
+
- 2 products visible (or 1.5 for hint)
|
|
125
|
+
- Larger touch targets on products
|
|
126
|
+
- Remove hover-only features (Quick View)
|
|
127
|
+
- Faster scroll animations (200-300ms)
|
|
128
|
+
|
|
129
|
+
**Performance on mobile:**
|
|
130
|
+
- Lazy load off-screen products
|
|
131
|
+
- Smaller image sizes
|
|
132
|
+
- Limit initial products loaded (8-10)
|
|
133
|
+
- Load more on scroll
|
|
134
|
+
|
|
135
|
+
## Performance
|
|
136
|
+
|
|
137
|
+
**Lazy loading (critical):**
|
|
138
|
+
- Only load visible products initially
|
|
139
|
+
- Load adjacent products (left/right) on demand
|
|
140
|
+
- Significantly improves page load time
|
|
141
|
+
- Use Intersection Observer API
|
|
142
|
+
|
|
143
|
+
**Image optimization:**
|
|
144
|
+
- Responsive images (smaller for mobile)
|
|
145
|
+
- WebP format with fallback
|
|
146
|
+
- Lazy load off-screen images
|
|
147
|
+
- Optimized thumbnails (<300KB)
|
|
148
|
+
|
|
149
|
+
**Limit slider length:**
|
|
150
|
+
- Max 20-30 products per slider
|
|
151
|
+
- "View All" link to full category page
|
|
152
|
+
- Improves performance
|
|
153
|
+
- Prevents endless scrolling
|
|
154
|
+
|
|
155
|
+
## Checklist
|
|
156
|
+
|
|
157
|
+
**Essential features:**
|
|
158
|
+
- [ ] 4-6 products visible (desktop), 2 (mobile)
|
|
159
|
+
- [ ] Arrow navigation (desktop)
|
|
160
|
+
- [ ] Swipe gesture (mobile)
|
|
161
|
+
- [ ] Product cards with image, title, price
|
|
162
|
+
- [ ] Responsive product count
|
|
163
|
+
- [ ] Smooth scroll transitions (300-400ms)
|
|
164
|
+
- [ ] Snap to product alignment
|
|
165
|
+
- [ ] Lazy load off-screen products
|
|
166
|
+
- [ ] "View All" link if many products (>20)
|
|
167
|
+
- [ ] Disable arrows at start/end
|
|
168
|
+
- [ ] Keyboard accessible (Tab through products)
|
|
169
|
+
- [ ] Mobile: No arrows, swipe only
|
|
170
|
+
- [ ] Optimized images (<300KB)
|
|
171
|
+
- [ ] Spacing between products (16-24px)
|
|
172
|
+
- [ ] ARIA labels on navigation (`aria-label="Previous products"`)
|
|
173
|
+
- [ ] `role="region"` on slider container
|
|
174
|
+
- [ ] NO auto-play for product sliders
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Search Component
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- [Overview](#overview)
|
|
6
|
+
- [Search Placement](#search-placement)
|
|
7
|
+
- [Autocomplete and Product Suggestions](#autocomplete-and-product-suggestions)
|
|
8
|
+
- [Search Results Page](#search-results-page)
|
|
9
|
+
- [Empty States](#empty-states)
|
|
10
|
+
- [Recent and Popular Searches](#recent-and-popular-searches)
|
|
11
|
+
- [Mobile Search](#mobile-search)
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Search is critical for ecommerce - users with search intent convert at higher rates. Provide fast, relevant product discovery with autocomplete.
|
|
16
|
+
|
|
17
|
+
**Assumed knowledge**: AI agents know how to build search inputs with icons and clear buttons. This guide focuses on ecommerce search patterns.
|
|
18
|
+
|
|
19
|
+
### Key Requirements
|
|
20
|
+
|
|
21
|
+
- Prominent search input (always accessible)
|
|
22
|
+
- Instant autocomplete after 2-3 characters
|
|
23
|
+
- Product suggestions with images
|
|
24
|
+
- Fast, relevant search results
|
|
25
|
+
- Filters to refine results
|
|
26
|
+
- Empty state guidance
|
|
27
|
+
- Mobile full-screen search modal
|
|
28
|
+
|
|
29
|
+
## Search Placement
|
|
30
|
+
|
|
31
|
+
**Desktop**: Navbar center (between logo and cart) or right side. Always visible, 300-500px width. Part of sticky navbar. Never hide in hamburger menu.
|
|
32
|
+
|
|
33
|
+
**Mobile**: Magnifying glass icon in top-right (44x44px minimum). Opens full-screen modal - eliminates distractions, maximizes suggestion space, better typing experience.
|
|
34
|
+
|
|
35
|
+
## Autocomplete and Product Suggestions
|
|
36
|
+
|
|
37
|
+
**Show suggestions** after 2-3 characters (not 1). Debounce 300ms to prevent excessive API calls.
|
|
38
|
+
|
|
39
|
+
**Display 5-10 product suggestions:**
|
|
40
|
+
- Small image (40-60px), title, price
|
|
41
|
+
- Clickable to product page
|
|
42
|
+
- Optional: Category/brand suggestions, popular terms
|
|
43
|
+
- Divide sections with headers
|
|
44
|
+
- "View all results for [query]" footer link
|
|
45
|
+
|
|
46
|
+
**Backend integration**: Fetch from search API. Check with ecommerce platform's documentation for API reference.
|
|
47
|
+
|
|
48
|
+
## Search Results Page
|
|
49
|
+
|
|
50
|
+
**Header**: "Search Results for '[query]'" + result count ("24 products found"). Search bar visible and pre-filled for refining.
|
|
51
|
+
|
|
52
|
+
**Grid layout**: Same as product listings (see product-listing.md). 1-4 columns based on device.
|
|
53
|
+
|
|
54
|
+
**Sorting**: Relevance (default, unique to search), Price Low/High, Newest.
|
|
55
|
+
|
|
56
|
+
**Filters**: Sidebar (desktop) or drawer (mobile). Category, Price, Brand, Availability with result counts.
|
|
57
|
+
|
|
58
|
+
## Empty States
|
|
59
|
+
|
|
60
|
+
**No results**: "No results for '[query]'" with helpful suggestions (check spelling, try broader keywords, browse categories). "Browse All Products" button + links to popular categories.
|
|
61
|
+
|
|
62
|
+
**Loading state**: Product card skeletons (6-8 cards), minimum 300ms display to avoid flashing.
|
|
63
|
+
|
|
64
|
+
## Recent and Popular Searches
|
|
65
|
+
|
|
66
|
+
**Recent searches** (user-specific, localStorage): Show 3-5 recent searches when input focused (before typing). Helps re-search without retyping.
|
|
67
|
+
|
|
68
|
+
**Popular searches** (site-wide, from backend): Show 5-10 trending terms when focused. Pill/tag styling.
|
|
69
|
+
|
|
70
|
+
Display both on: Empty input focus (desktop dropdown), mobile modal open.
|
|
71
|
+
|
|
72
|
+
## Mobile Search
|
|
73
|
+
|
|
74
|
+
**Full-screen modal pattern:**
|
|
75
|
+
- Header: Back button (44x44px) + search input (48px height, auto-focus, `type="search"`)
|
|
76
|
+
- Content: Recent/popular searches (empty), autocomplete (typing), scrollable
|
|
77
|
+
- Close: Back button, device back gesture, Escape key
|
|
78
|
+
|
|
79
|
+
## Ecommerce Search Checklist
|
|
80
|
+
|
|
81
|
+
**Essential features:**
|
|
82
|
+
|
|
83
|
+
- [ ] Prominent search input in navbar (desktop)
|
|
84
|
+
- [ ] Search icon clearly visible (mobile)
|
|
85
|
+
- [ ] Full-screen modal on mobile tap
|
|
86
|
+
- [ ] Autocomplete after 2-3 characters
|
|
87
|
+
- [ ] Debounced API calls (300ms)
|
|
88
|
+
- [ ] Product suggestions with images, prices
|
|
89
|
+
- [ ] "View all results" link in dropdown
|
|
90
|
+
- [ ] Search results page shows query
|
|
91
|
+
- [ ] Result count displayed
|
|
92
|
+
- [ ] Sort by Relevance (default for search)
|
|
93
|
+
- [ ] Filters for refining results (category, price, brand)
|
|
94
|
+
- [ ] Empty state with helpful guidance
|
|
95
|
+
- [ ] Loading state indicator (skeleton)
|
|
96
|
+
- [ ] Recent searches (localStorage)
|
|
97
|
+
- [ ] Popular searches (from backend)
|
|
98
|
+
- [ ] Mobile: Auto-focus, large input (48px)
|
|
99
|
+
- [ ] Keyboard navigation (arrow keys, Enter, Escape)
|
|
100
|
+
- [ ] ARIA labels (`role="search"`, `aria-label`)
|
|
101
|
+
- [ ] Accessible to screen readers
|