@thorprovider/blocks 0.1.0
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/.turbo/turbo-build.log +24 -0
- package/.turbo/turbo-test.log +10 -0
- package/.turbo/turbo-type-check.log +0 -0
- package/AGENTS.md +1 -0
- package/README.md +161 -0
- package/components.json +33 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/contracts.d.mts +563 -0
- package/dist/contracts.d.ts +563 -0
- package/dist/contracts.js +207 -0
- package/dist/contracts.js.map +1 -0
- package/dist/contracts.mjs +168 -0
- package/dist/contracts.mjs.map +1 -0
- package/dist/index.d.mts +2408 -0
- package/dist/index.d.ts +2408 -0
- package/dist/index.js +16422 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +16352 -0
- package/dist/index.mjs.map +1 -0
- package/docs/standards/data-contracts.md +70 -0
- package/docs/standards/theming.md +85 -0
- package/package.json +62 -0
- package/src/blocks/application/app-shells/app-shell-1-sidebar.tsx +198 -0
- package/src/blocks/application/app-shells/app-shell-1.tsx +196 -0
- package/src/blocks/application/login-forms/login-page-1.tsx +246 -0
- package/src/blocks/application/login-forms/login-page-2.tsx +207 -0
- package/src/blocks/application/password-recovery/forgot-password-page-1-brand-mark.tsx +38 -0
- package/src/blocks/application/password-recovery/forgot-password-page-1.tsx +320 -0
- package/src/blocks/application/signup-forms/signup-page-1.tsx +231 -0
- package/src/blocks/application/verification/verify-1.tsx +307 -0
- package/src/blocks/application/verification/verify-confetti.tsx +192 -0
- package/src/blocks/e-commerce/category-filters/category-filter-1.tsx +260 -0
- package/src/blocks/e-commerce/category-filters/category-filter-2-filter-panel.tsx +179 -0
- package/src/blocks/e-commerce/category-filters/category-filter-2.tsx +341 -0
- package/src/blocks/e-commerce/category-filters/category-filter-4-chip-rail.tsx +57 -0
- package/src/blocks/e-commerce/category-filters/category-filter-4-drawer.tsx +124 -0
- package/src/blocks/e-commerce/category-filters/category-filter-4-fields.tsx +170 -0
- package/src/blocks/e-commerce/category-filters/category-filter-4-sidebar.tsx +52 -0
- package/src/blocks/e-commerce/category-filters/category-filter-4-sort-sheet.tsx +57 -0
- package/src/blocks/e-commerce/category-filters/category-filter-4-state.ts +68 -0
- package/src/blocks/e-commerce/category-filters/category-filter-4.tsx +298 -0
- package/src/blocks/e-commerce/checkout-forms/card-formatting.test.ts +47 -0
- package/src/blocks/e-commerce/checkout-forms/card-formatting.ts +9 -0
- package/src/blocks/e-commerce/checkout-forms/checkbox-check.tsx +74 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-confirmation-fulfilment-progress.tsx +189 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-confirmation.tsx +283 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-field-feedback.tsx +29 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-1-contact-step.tsx +96 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-1-country-field.tsx +51 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-1-order-summary.tsx +139 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-1-payment-step.tsx +184 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-1-progress.tsx +36 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-1-shipping-step.tsx +107 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-1.tsx +235 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-2-order-summary.tsx +130 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-2-payment-card.tsx +175 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-2-shipping-card.tsx +190 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-2.tsx +312 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-3-information-step.tsx +91 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-3-order-summary.tsx +110 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-3-payment-step.tsx +137 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-3-progress.tsx +68 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-3-review-step.tsx +79 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-3-shipping-step.tsx +172 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-3.tsx +392 -0
- package/src/blocks/e-commerce/checkout-forms/checkout-form-types.ts +7 -0
- package/src/blocks/e-commerce/navigation/category-icon.test.tsx +54 -0
- package/src/blocks/e-commerce/navigation/category-icon.tsx +94 -0
- package/src/blocks/e-commerce/navigation/mega-menu.test.tsx +139 -0
- package/src/blocks/e-commerce/navigation/mega-menu.tsx +271 -0
- package/src/blocks/e-commerce/navigation/mobile-category-drawer.test.tsx +152 -0
- package/src/blocks/e-commerce/navigation/mobile-category-drawer.tsx +276 -0
- package/src/blocks/e-commerce/order-history/order-history-1.tsx +159 -0
- package/src/blocks/e-commerce/order-history/order-history-2.tsx +222 -0
- package/src/blocks/e-commerce/product-categories/avatar-group.tsx +86 -0
- package/src/blocks/e-commerce/product-categories/product-category-1.tsx +126 -0
- package/src/blocks/e-commerce/product-categories/product-category-2.tsx +100 -0
- package/src/blocks/e-commerce/product-categories/product-category-4.tsx +129 -0
- package/src/blocks/e-commerce/product-categories/product-category-5.tsx +218 -0
- package/src/blocks/e-commerce/product-list/product-card-1.tsx +131 -0
- package/src/blocks/e-commerce/product-list/product-card-2.tsx +71 -0
- package/src/blocks/e-commerce/product-list/product-card-3-reaction-toggle.tsx +166 -0
- package/src/blocks/e-commerce/product-list/product-card-3.tsx +215 -0
- package/src/blocks/e-commerce/product-list/product-card-5-checkbox-check.tsx +98 -0
- package/src/blocks/e-commerce/product-list/product-card-5-reaction-toggle.tsx +171 -0
- package/src/blocks/e-commerce/product-list/product-card-5.tsx +367 -0
- package/src/blocks/e-commerce/product-overview/product-overview-1.tsx +201 -0
- package/src/blocks/e-commerce/product-overview/product-overview-2.tsx +272 -0
- package/src/blocks/e-commerce/product-overview/product-overview-5-gallery.tsx +59 -0
- package/src/blocks/e-commerce/product-overview/product-overview-5-lightbox-tab.tsx +104 -0
- package/src/blocks/e-commerce/product-overview/product-overview-5-reviews-tab.tsx +82 -0
- package/src/blocks/e-commerce/product-overview/product-overview-5-tabs.tsx +69 -0
- package/src/blocks/e-commerce/product-overview/product-overview-5.tsx +274 -0
- package/src/blocks/e-commerce/product-overview/product-quick-view-card.tsx +135 -0
- package/src/blocks/e-commerce/product-overview/product-quick-view-dialog.tsx +393 -0
- package/src/blocks/e-commerce/product-overview/product-quick-view.tsx +136 -0
- package/src/blocks/e-commerce/reviews/review-rating-1-review-form.tsx +133 -0
- package/src/blocks/e-commerce/reviews/review-rating-1.tsx +178 -0
- package/src/blocks/e-commerce/reviews/review-rating-2.tsx +246 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-1-spinning-counter.tsx +142 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-1.tsx +291 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-2-item-row.tsx +110 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-2-recommendations.tsx +51 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-2-spinning-counter.tsx +146 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-2.tsx +295 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-3-spinning-counter.tsx +142 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-3.tsx +342 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-4-spinning-counter.tsx +146 -0
- package/src/blocks/e-commerce/shopping-carts/shopping-cart-4.tsx +391 -0
- package/src/blocks/e-commerce/store-containers/store-container-1.tsx +29 -0
- package/src/blocks/e-commerce/storefront-hero/storefront-hero-1.tsx +244 -0
- package/src/blocks/e-commerce/storefront-hero/storefront-hero-2.tsx +283 -0
- package/src/blocks/e-commerce/storefront-hero/storefront-hero-5.tsx +318 -0
- package/src/blocks/e-commerce/storefront-hero/storefront-hero-6.tsx +205 -0
- package/src/blocks/marketing/banners/avatar-group.tsx +69 -0
- package/src/blocks/marketing/banners/banner-1.tsx +188 -0
- package/src/blocks/marketing/cta/cta-section-1.tsx +112 -0
- package/src/blocks/marketing/faq/faq-block-1.tsx +45 -0
- package/src/blocks/marketing/features/feature-1.tsx +97 -0
- package/src/blocks/marketing/features/feature-2.tsx +82 -0
- package/src/blocks/marketing/footers/footer-section-1.tsx +141 -0
- package/src/blocks/marketing/footers/footer-section-3.tsx +192 -0
- package/src/blocks/marketing/footers/footer-section-4.tsx +355 -0
- package/src/blocks/marketing/hero-sections/avatar-group.tsx +86 -0
- package/src/blocks/marketing/hero-sections/hero-section-1.tsx +135 -0
- package/src/blocks/marketing/logo-clouds/logo-cloud-1-logo-icon.tsx +52 -0
- package/src/blocks/marketing/logo-clouds/logo-cloud-1.tsx +56 -0
- package/src/blocks/marketing/navbars/navbar-1.tsx +267 -0
- package/src/blocks/marketing/navbars/navbar-2.tsx +351 -0
- package/src/blocks/marketing/navbars/navbar-3.tsx +303 -0
- package/src/blocks/marketing/navbars/navbar-4-account-menu.tsx +118 -0
- package/src/blocks/marketing/navbars/navbar-4-cart-sheet.tsx +248 -0
- package/src/blocks/marketing/navbars/navbar-4-like-button.tsx +177 -0
- package/src/blocks/marketing/navbars/navbar-4-mobile-nav.tsx +104 -0
- package/src/blocks/marketing/navbars/navbar-4-product-grid.tsx +219 -0
- package/src/blocks/marketing/navbars/navbar-4-search-bar.tsx +52 -0
- package/src/blocks/marketing/navbars/navbar-4.tsx +411 -0
- package/src/blocks/marketing/pricing/pricing-section-1.tsx +94 -0
- package/src/blocks/marketing/statistics/statistic-1.tsx +93 -0
- package/src/blocks/marketing/testimonials/testimonial-1.tsx +141 -0
- package/src/blocks/marketing/testimonials/testimonial-2.tsx +108 -0
- package/src/blocks/shared/reaction-toggle.tsx +145 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/index.ts +200 -0
- package/src/lib/contracts.test.ts +32 -0
- package/src/lib/contracts.ts +235 -0
- package/src/lib/types/menu.ts +43 -0
- package/src/lib/types.ts +4 -0
- package/src/lib/utils.ts +10 -0
- package/src/ui/accordion.tsx +65 -0
- package/src/ui/avatar.tsx +108 -0
- package/src/ui/badge.tsx +47 -0
- package/src/ui/breadcrumb.tsx +108 -0
- package/src/ui/button-group.tsx +83 -0
- package/src/ui/button.tsx +63 -0
- package/src/ui/card.tsx +91 -0
- package/src/ui/carousel.tsx +241 -0
- package/src/ui/dialog.tsx +158 -0
- package/src/ui/drawer.tsx +134 -0
- package/src/ui/dropdown-menu.tsx +256 -0
- package/src/ui/empty.tsx +103 -0
- package/src/ui/field.tsx +248 -0
- package/src/ui/input-group.tsx +170 -0
- package/src/ui/input-otp.tsx +76 -0
- package/src/ui/input.tsx +20 -0
- package/src/ui/label.tsx +23 -0
- package/src/ui/navigation-menu.tsx +167 -0
- package/src/ui/pagination.tsx +127 -0
- package/src/ui/progress.tsx +30 -0
- package/src/ui/radio-group.tsx +44 -0
- package/src/ui/select.tsx +189 -0
- package/src/ui/separator.tsx +27 -0
- package/src/ui/sheet.tsx +142 -0
- package/src/ui/sidebar.tsx +726 -0
- package/src/ui/skeleton.tsx +13 -0
- package/src/ui/table.tsx +115 -0
- package/src/ui/tabs.tsx +90 -0
- package/src/ui/textarea.tsx +17 -0
- package/src/ui/toggle-group.tsx +83 -0
- package/src/ui/toggle.tsx +46 -0
- package/src/ui/tooltip.tsx +56 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +16 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import type { LucideIcon } from 'lucide-react'
|
|
4
|
+
import { Users, ShoppingBag } from 'lucide-react'
|
|
5
|
+
|
|
6
|
+
import { Card, CardContent } from '../../../ui/card'
|
|
7
|
+
import { Badge } from '../../../ui/badge'
|
|
8
|
+
import { Avatar, AvatarImage, AvatarFallback } from '../../../ui/avatar'
|
|
9
|
+
import { AvatarGroup } from './avatar-group'
|
|
10
|
+
|
|
11
|
+
export interface ProductCategory4Category {
|
|
12
|
+
id: string
|
|
13
|
+
title: string
|
|
14
|
+
description: string
|
|
15
|
+
icon: LucideIcon
|
|
16
|
+
customers: string
|
|
17
|
+
products: number
|
|
18
|
+
avatarImages?: string[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ProductCategory4Props {
|
|
22
|
+
title?: string
|
|
23
|
+
description?: string
|
|
24
|
+
categories: ProductCategory4Category[]
|
|
25
|
+
productsLabel?: string
|
|
26
|
+
customersLabel?: string
|
|
27
|
+
onCategoryClick?: (category: ProductCategory4Category) => void
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getInitials(title: string): string {
|
|
31
|
+
return title
|
|
32
|
+
.split(/\s+/)
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.slice(0, 2)
|
|
35
|
+
.map(word => word.charAt(0).toUpperCase())
|
|
36
|
+
.join('')
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function ProductCategory4({
|
|
40
|
+
title = 'Compra por categoría',
|
|
41
|
+
description = 'Explora nuestra selección de repuestos y accesorios',
|
|
42
|
+
categories,
|
|
43
|
+
productsLabel = 'productos',
|
|
44
|
+
customersLabel = 'clientes',
|
|
45
|
+
onCategoryClick,
|
|
46
|
+
}: ProductCategory4Props) {
|
|
47
|
+
return (
|
|
48
|
+
<section className='bg-background w-full py-12 md:py-16'>
|
|
49
|
+
<div className='mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8'>
|
|
50
|
+
<div className='mx-auto mb-12 max-w-3xl text-center'>
|
|
51
|
+
<h2 className='text-foreground mb-4 text-3xl font-bold tracking-tight md:text-4xl lg:text-5xl'>
|
|
52
|
+
{title}
|
|
53
|
+
</h2>
|
|
54
|
+
<p className='text-muted-foreground text-lg md:text-xl'>{description}</p>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div className='grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3'>
|
|
58
|
+
{categories.map(category => {
|
|
59
|
+
const Icon = category.icon
|
|
60
|
+
const clickable = Boolean(onCategoryClick)
|
|
61
|
+
return (
|
|
62
|
+
<Card
|
|
63
|
+
key={category.id}
|
|
64
|
+
className={`group relative overflow-hidden transition-all hover:shadow-md ${
|
|
65
|
+
clickable ? 'cursor-pointer' : ''
|
|
66
|
+
}`}
|
|
67
|
+
onClick={onCategoryClick ? () => onCategoryClick(category) : undefined}
|
|
68
|
+
aria-label={clickable ? category.title : undefined}
|
|
69
|
+
>
|
|
70
|
+
<CardContent>
|
|
71
|
+
<div className='mb-4 flex items-center justify-between'>
|
|
72
|
+
<div className='bg-accent text-primary rounded-lg p-2.5' aria-hidden='true'>
|
|
73
|
+
<Icon className='size-5' />
|
|
74
|
+
</div>
|
|
75
|
+
<Badge
|
|
76
|
+
variant='secondary'
|
|
77
|
+
className='bg-muted/50 rounded-sm px-2 py-1 font-semibold'
|
|
78
|
+
aria-label={`${category.products} ${productsLabel}`}
|
|
79
|
+
>
|
|
80
|
+
<ShoppingBag className='me-1 size-3' />
|
|
81
|
+
{category.products} {productsLabel}
|
|
82
|
+
</Badge>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<h3 className='text-foreground mb-2 text-lg font-semibold'>{category.title}</h3>
|
|
86
|
+
<p className='text-muted-foreground mb-4 text-sm'>{category.description}</p>
|
|
87
|
+
|
|
88
|
+
<div className='flex items-center justify-between'>
|
|
89
|
+
<div className='flex items-center gap-2'>
|
|
90
|
+
{category.avatarImages?.length ? (
|
|
91
|
+
<>
|
|
92
|
+
<AvatarGroup>
|
|
93
|
+
{category.avatarImages.slice(0, 3).map((src, i) => (
|
|
94
|
+
<Avatar key={i} className='bg-muted size-6 border'>
|
|
95
|
+
<AvatarImage src={src || undefined} alt='' />
|
|
96
|
+
<AvatarFallback>{getInitials(category.title)}</AvatarFallback>
|
|
97
|
+
</Avatar>
|
|
98
|
+
))}
|
|
99
|
+
</AvatarGroup>
|
|
100
|
+
<span
|
|
101
|
+
className='text-muted-foreground flex items-center gap-1 text-sm'
|
|
102
|
+
aria-label={`${category.customers} ${customersLabel}`}
|
|
103
|
+
>
|
|
104
|
+
<Users className='h-3.5 w-3.5' aria-hidden='true' />
|
|
105
|
+
{category.customers} {customersLabel}
|
|
106
|
+
</span>
|
|
107
|
+
</>
|
|
108
|
+
) : (
|
|
109
|
+
<span
|
|
110
|
+
className='text-muted-foreground flex items-center gap-1 text-sm'
|
|
111
|
+
aria-label={`${category.customers} ${customersLabel}`}
|
|
112
|
+
>
|
|
113
|
+
<Users className='h-3.5 w-3.5' aria-hidden='true' />
|
|
114
|
+
{category.customers} {customersLabel}
|
|
115
|
+
</span>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</CardContent>
|
|
120
|
+
</Card>
|
|
121
|
+
)
|
|
122
|
+
})}
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</section>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export default ProductCategory4
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { Card, CardContent } from '../../../ui/card'
|
|
5
|
+
import { Badge } from '../../../ui/badge'
|
|
6
|
+
import { Button } from '../../../ui/button'
|
|
7
|
+
import { Input } from '../../../ui/input'
|
|
8
|
+
import {
|
|
9
|
+
ArrowRight,
|
|
10
|
+
Search,
|
|
11
|
+
Laptop,
|
|
12
|
+
Shirt,
|
|
13
|
+
Home,
|
|
14
|
+
Dumbbell,
|
|
15
|
+
BookOpen,
|
|
16
|
+
Heart,
|
|
17
|
+
Car,
|
|
18
|
+
Utensils,
|
|
19
|
+
Gamepad2,
|
|
20
|
+
Baby,
|
|
21
|
+
Gift,
|
|
22
|
+
Wrench,
|
|
23
|
+
} from 'lucide-react'
|
|
24
|
+
import { cn } from '../../../lib/utils'
|
|
25
|
+
|
|
26
|
+
export type CategoryIcon =
|
|
27
|
+
| 'electronics'
|
|
28
|
+
| 'fashion'
|
|
29
|
+
| 'home'
|
|
30
|
+
| 'sports'
|
|
31
|
+
| 'books'
|
|
32
|
+
| 'beauty'
|
|
33
|
+
| 'automotive'
|
|
34
|
+
| 'food'
|
|
35
|
+
| 'gaming'
|
|
36
|
+
| 'baby'
|
|
37
|
+
| 'gifts'
|
|
38
|
+
| 'tools'
|
|
39
|
+
|
|
40
|
+
export interface ProductCategory5Category {
|
|
41
|
+
id: string
|
|
42
|
+
name: string
|
|
43
|
+
icon: CategoryIcon
|
|
44
|
+
description: string
|
|
45
|
+
itemCount: number
|
|
46
|
+
subcategories: string[]
|
|
47
|
+
featured?: boolean
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ProductCategory5Props {
|
|
51
|
+
title?: string
|
|
52
|
+
description?: string
|
|
53
|
+
categories: ProductCategory5Category[]
|
|
54
|
+
searchPlaceholder?: string
|
|
55
|
+
productsLabel?: string
|
|
56
|
+
featuredLabel?: string
|
|
57
|
+
browseLabel?: string
|
|
58
|
+
viewAllLabel?: string
|
|
59
|
+
notFoundLabel?: string
|
|
60
|
+
onBrowse?: (category: ProductCategory5Category) => void
|
|
61
|
+
onViewAll?: () => void
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const categoryIcons: Record<CategoryIcon, typeof Laptop> = {
|
|
65
|
+
electronics: Laptop,
|
|
66
|
+
fashion: Shirt,
|
|
67
|
+
home: Home,
|
|
68
|
+
sports: Dumbbell,
|
|
69
|
+
books: BookOpen,
|
|
70
|
+
beauty: Heart,
|
|
71
|
+
automotive: Car,
|
|
72
|
+
food: Utensils,
|
|
73
|
+
gaming: Gamepad2,
|
|
74
|
+
baby: Baby,
|
|
75
|
+
gifts: Gift,
|
|
76
|
+
tools: Wrench,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function ProductCategory5({
|
|
80
|
+
title = 'Explora categorías',
|
|
81
|
+
description = 'Encuentra lo que necesitas en nuestras categorías organizadas',
|
|
82
|
+
categories,
|
|
83
|
+
searchPlaceholder = 'Buscar categorías...',
|
|
84
|
+
productsLabel = 'productos disponibles',
|
|
85
|
+
featuredLabel = 'Destacado',
|
|
86
|
+
browseLabel = 'Explorar',
|
|
87
|
+
viewAllLabel = 'Ver todos los productos',
|
|
88
|
+
notFoundLabel = '¿No encuentras lo que buscas?',
|
|
89
|
+
onBrowse,
|
|
90
|
+
onViewAll,
|
|
91
|
+
}: ProductCategory5Props) {
|
|
92
|
+
const [query, setQuery] = useState('')
|
|
93
|
+
|
|
94
|
+
const filteredCategories = categories.filter(category => {
|
|
95
|
+
const q = query.trim().toLowerCase()
|
|
96
|
+
if (!q) return true
|
|
97
|
+
return (
|
|
98
|
+
category.name.toLowerCase().includes(q) ||
|
|
99
|
+
category.subcategories.some(sub => sub.toLowerCase().includes(q))
|
|
100
|
+
)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
const totalCount = categories.reduce((sum, category) => sum + category.itemCount, 0)
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<section className='py-12'>
|
|
107
|
+
<div className='mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8'>
|
|
108
|
+
<div className='mb-8 text-center'>
|
|
109
|
+
<h2 className='mb-4 text-3xl font-bold tracking-tight text-balance'>{title}</h2>
|
|
110
|
+
<p className='text-muted-foreground mb-6 text-lg'>{description}</p>
|
|
111
|
+
|
|
112
|
+
<div className='relative mx-auto max-w-md'>
|
|
113
|
+
<Search
|
|
114
|
+
className='text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2'
|
|
115
|
+
aria-hidden='true'
|
|
116
|
+
/>
|
|
117
|
+
<Input
|
|
118
|
+
placeholder={searchPlaceholder}
|
|
119
|
+
value={query}
|
|
120
|
+
onChange={e => setQuery(e.target.value)}
|
|
121
|
+
className='ps-9 h-9'
|
|
122
|
+
aria-label='Buscar categorías'
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
{filteredCategories.length === 0 ? (
|
|
128
|
+
<p className='text-muted-foreground py-10 text-center text-sm'>
|
|
129
|
+
Sin resultados para "{query.trim()}"
|
|
130
|
+
</p>
|
|
131
|
+
) : (
|
|
132
|
+
<div className='grid grid-cols-1 gap-4 lg:grid-cols-2'>
|
|
133
|
+
{filteredCategories.map(category => {
|
|
134
|
+
const Icon = categoryIcons[category.icon]
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<Card
|
|
138
|
+
key={category.id}
|
|
139
|
+
className={cn(
|
|
140
|
+
'group hover:border-primary relative py-0 transition-all duration-200 hover:shadow-md'
|
|
141
|
+
)}
|
|
142
|
+
>
|
|
143
|
+
<CardContent className='p-6'>
|
|
144
|
+
<div className='flex items-start gap-4'>
|
|
145
|
+
<div className='flex-shrink-0'>
|
|
146
|
+
<div className='bg-primary/10 group-hover:bg-primary/20 flex size-12 items-center justify-center rounded-lg transition-colors'>
|
|
147
|
+
<Icon className='text-primary size-6' aria-hidden='true' />
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<div className='min-w-0 flex-1'>
|
|
152
|
+
<div className='flex items-start justify-between'>
|
|
153
|
+
<div className='flex-1'>
|
|
154
|
+
<div className='mb-2 flex items-center gap-2'>
|
|
155
|
+
<h3 className='text-lg font-semibold transition-colors'>{category.name}</h3>
|
|
156
|
+
{category.featured ? (
|
|
157
|
+
<Badge
|
|
158
|
+
variant='secondary'
|
|
159
|
+
className='rounded-sm px-2 py-0.5 font-semibold'
|
|
160
|
+
>
|
|
161
|
+
{featuredLabel}
|
|
162
|
+
</Badge>
|
|
163
|
+
) : null}
|
|
164
|
+
</div>
|
|
165
|
+
<p className='text-muted-foreground mb-3 line-clamp-2 text-sm'>
|
|
166
|
+
{category.description}
|
|
167
|
+
</p>
|
|
168
|
+
|
|
169
|
+
<div className='mb-3 flex flex-wrap gap-2'>
|
|
170
|
+
{category.subcategories.map((sub, index) => (
|
|
171
|
+
<span
|
|
172
|
+
key={index}
|
|
173
|
+
className='bg-muted text-muted-foreground rounded-md px-2 py-1 text-xs'
|
|
174
|
+
>
|
|
175
|
+
{sub}
|
|
176
|
+
</span>
|
|
177
|
+
))}
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<div className='text-muted-foreground text-sm'>
|
|
181
|
+
{category.itemCount.toLocaleString()} {productsLabel}
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
<Button
|
|
188
|
+
variant='ghost'
|
|
189
|
+
size='sm'
|
|
190
|
+
className='absolute end-4 bottom-4 h-8 cursor-pointer px-3 text-xs opacity-0 transition-opacity group-hover:opacity-100'
|
|
191
|
+
onClick={onBrowse ? () => onBrowse(category) : undefined}
|
|
192
|
+
>
|
|
193
|
+
{browseLabel}
|
|
194
|
+
<ArrowRight />
|
|
195
|
+
</Button>
|
|
196
|
+
</CardContent>
|
|
197
|
+
</Card>
|
|
198
|
+
)
|
|
199
|
+
})}
|
|
200
|
+
</div>
|
|
201
|
+
)}
|
|
202
|
+
|
|
203
|
+
<div className='mt-8 text-center'>
|
|
204
|
+
<p className='text-muted-foreground mb-4 text-sm'>{notFoundLabel}</p>
|
|
205
|
+
<Button
|
|
206
|
+
variant='outline'
|
|
207
|
+
className='h-9 cursor-pointer px-4 py-2'
|
|
208
|
+
onClick={onViewAll}
|
|
209
|
+
>
|
|
210
|
+
{viewAllLabel} {totalCount.toLocaleString()}
|
|
211
|
+
</Button>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</section>
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export default ProductCategory5
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { motion, useReducedMotion } from 'motion/react'
|
|
4
|
+
|
|
5
|
+
import { Button } from '../../../ui/button'
|
|
6
|
+
import { Card, CardContent, CardFooter } from '../../../ui/card'
|
|
7
|
+
|
|
8
|
+
export interface Product {
|
|
9
|
+
id: string | number
|
|
10
|
+
title: string
|
|
11
|
+
price: number
|
|
12
|
+
originalPrice?: number
|
|
13
|
+
image: string
|
|
14
|
+
badge?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ProductCard1Props {
|
|
18
|
+
products: Product[]
|
|
19
|
+
heading?: string
|
|
20
|
+
maxItems?: number
|
|
21
|
+
onAddToCart?: (product: Product) => void
|
|
22
|
+
onProductClick?: (product: Product) => void
|
|
23
|
+
addToCartLabel?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function ProductCard1({
|
|
27
|
+
products,
|
|
28
|
+
heading,
|
|
29
|
+
maxItems = 6,
|
|
30
|
+
onAddToCart,
|
|
31
|
+
onProductClick,
|
|
32
|
+
addToCartLabel = 'Agregar al carrito',
|
|
33
|
+
}: ProductCard1Props) {
|
|
34
|
+
const reduceMotion = useReducedMotion()
|
|
35
|
+
const displayedProducts = products.slice(0, maxItems)
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<section className='py-12'>
|
|
39
|
+
<div className='mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8'>
|
|
40
|
+
{heading && (
|
|
41
|
+
<h2 className='mb-8 text-center text-2xl font-bold text-balance md:text-3xl'>{heading}</h2>
|
|
42
|
+
)}
|
|
43
|
+
|
|
44
|
+
<div className='grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:gap-6'>
|
|
45
|
+
{displayedProducts.map((product, index) => (
|
|
46
|
+
<motion.div
|
|
47
|
+
key={product.id}
|
|
48
|
+
initial={reduceMotion ? false : { opacity: 0, y: 16 }}
|
|
49
|
+
whileInView={{ opacity: 1, y: 0 }}
|
|
50
|
+
viewport={{ once: true, margin: '-40px' }}
|
|
51
|
+
whileHover={reduceMotion ? undefined : { y: -4 }}
|
|
52
|
+
transition={{
|
|
53
|
+
duration: 0.35,
|
|
54
|
+
delay: reduceMotion ? 0 : index * 0.05,
|
|
55
|
+
ease: 'easeOut',
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<Card
|
|
59
|
+
className={`flex h-full flex-col gap-4 overflow-hidden rounded-lg py-4 shadow-none transition-shadow duration-300 hover:shadow-md ${
|
|
60
|
+
onProductClick ? 'cursor-pointer' : ''
|
|
61
|
+
}`}
|
|
62
|
+
onClick={onProductClick ? () => onProductClick(product) : undefined}
|
|
63
|
+
>
|
|
64
|
+
<CardContent className='flex flex-1 flex-col gap-4 px-4 '>
|
|
65
|
+
<div className='relative aspect-square overflow-hidden rounded-md'>
|
|
66
|
+
{product.badge && (
|
|
67
|
+
<span className='bg-destructive text-destructive-foreground absolute top-2 left-2 z-10 rounded-full px-2 py-0.5 text-xs font-semibold'>
|
|
68
|
+
{product.badge}
|
|
69
|
+
</span>
|
|
70
|
+
)}
|
|
71
|
+
<img
|
|
72
|
+
src={product.image || undefined}
|
|
73
|
+
alt={product.title}
|
|
74
|
+
className='size-full rounded-md object-contain'
|
|
75
|
+
loading='lazy'
|
|
76
|
+
width={400}
|
|
77
|
+
height={400}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div className='flex flex-1 flex-col'>
|
|
82
|
+
<h2 className='mb-1 font-medium text-balance'>
|
|
83
|
+
{onProductClick ? (
|
|
84
|
+
<button
|
|
85
|
+
type='button'
|
|
86
|
+
onClick={(e) => {
|
|
87
|
+
e.stopPropagation()
|
|
88
|
+
onProductClick(product)
|
|
89
|
+
}}
|
|
90
|
+
className='hover:text-primary cursor-pointer text-left transition-colors'
|
|
91
|
+
>
|
|
92
|
+
{product.title}
|
|
93
|
+
</button>
|
|
94
|
+
) : (
|
|
95
|
+
product.title
|
|
96
|
+
)}
|
|
97
|
+
</h2>
|
|
98
|
+
<div className='mt-auto flex items-baseline gap-2'>
|
|
99
|
+
<p className='font-semibold'>${product.price.toFixed(2)}</p>
|
|
100
|
+
{product.originalPrice && (
|
|
101
|
+
<p className='text-muted-foreground text-sm line-through md:text-base xl:text-sm 2xl:text-base'>
|
|
102
|
+
${product.originalPrice.toFixed(2)}
|
|
103
|
+
</p>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</CardContent>
|
|
108
|
+
|
|
109
|
+
<CardFooter className='bg-transparent px-3 pt-0 border-t-0 md:px-4'>
|
|
110
|
+
<Button
|
|
111
|
+
variant='outline'
|
|
112
|
+
size='sm'
|
|
113
|
+
className='h-8 w-full cursor-pointer px-3 text-sm text-xs'
|
|
114
|
+
onClick={(e) => {
|
|
115
|
+
e.stopPropagation()
|
|
116
|
+
onAddToCart?.(product)
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{addToCartLabel}
|
|
120
|
+
</Button>
|
|
121
|
+
</CardFooter>
|
|
122
|
+
</Card>
|
|
123
|
+
</motion.div>
|
|
124
|
+
))}
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</section>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export default ProductCard1
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Star } from 'lucide-react'
|
|
2
|
+
import { Card, CardContent, CardTitle } from '../../../ui/card'
|
|
3
|
+
|
|
4
|
+
export interface ProductCard2Product {
|
|
5
|
+
id: string | number
|
|
6
|
+
title: string
|
|
7
|
+
image: string
|
|
8
|
+
price: number
|
|
9
|
+
rating: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ProductCard2Props {
|
|
13
|
+
products: ProductCard2Product[]
|
|
14
|
+
heading?: string
|
|
15
|
+
description?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function ProductCard2({ products, heading, description }: ProductCard2Props) {
|
|
19
|
+
return (
|
|
20
|
+
<section className='py-12'>
|
|
21
|
+
<div className='mx-auto flex w-full max-w-7xl flex-col gap-8 px-4 sm:px-6 lg:px-8'>
|
|
22
|
+
{heading || description ? (
|
|
23
|
+
<header className='flex flex-col gap-2'>
|
|
24
|
+
{heading && <h2 className='text-3xl font-bold text-balance sm:text-4xl'>{heading}</h2>}
|
|
25
|
+
{description && (
|
|
26
|
+
<p className='text-muted-foreground max-w-[60ch] text-balance'>{description}</p>
|
|
27
|
+
)}
|
|
28
|
+
</header>
|
|
29
|
+
) : null}
|
|
30
|
+
|
|
31
|
+
<div className='grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-6 lg:grid-cols-3'>
|
|
32
|
+
{products.map(product => (
|
|
33
|
+
<Card key={product.id} className='group overflow-hidden transition-all hover:shadow-lg'>
|
|
34
|
+
<CardContent className='flex flex-col gap-4'>
|
|
35
|
+
<div className='overflow-hidden rounded-md'>
|
|
36
|
+
<img
|
|
37
|
+
src={product.image || undefined}
|
|
38
|
+
alt={product.title}
|
|
39
|
+
width={400}
|
|
40
|
+
height={400}
|
|
41
|
+
className='aspect-square w-full object-cover transition-transform duration-300 group-hover:scale-105'
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div className='flex flex-col gap-2'>
|
|
46
|
+
<CardTitle className='line-clamp-1 text-lg font-semibold text-balance sm:text-xl'>
|
|
47
|
+
{product.title}
|
|
48
|
+
</CardTitle>
|
|
49
|
+
|
|
50
|
+
<div
|
|
51
|
+
className='flex items-center gap-0.5'
|
|
52
|
+
aria-label={`${product.rating} out of 5 stars`}
|
|
53
|
+
role='img'
|
|
54
|
+
>
|
|
55
|
+
{Array.from({ length: product.rating }).map((_, i) => (
|
|
56
|
+
<Star key={i} className='fill-foreground text-foreground size-4 sm:size-5' />
|
|
57
|
+
))}
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<p className='text-lg font-semibold sm:text-xl'>${product.price.toFixed(2)}</p>
|
|
61
|
+
</div>
|
|
62
|
+
</CardContent>
|
|
63
|
+
</Card>
|
|
64
|
+
))}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</section>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default ProductCard2
|