@shohojdhara/atomix 0.4.8 → 0.5.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/atomix.config.ts +58 -1
- package/dist/atomix.css +148 -120
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +33 -0
- package/dist/charts.js +1227 -122
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +33 -10
- package/dist/core.js +1052 -41
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +33 -0
- package/dist/forms.js +2086 -1035
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +42 -1
- package/dist/heavy.js +1620 -600
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +441 -270
- package/dist/index.esm.js +1900 -638
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1935 -670
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +6 -3
- package/scripts/atomix-cli.js +148 -4
- package/scripts/cli/__tests__/basic.test.js +3 -2
- package/scripts/cli/__tests__/clean.test.js +278 -0
- package/scripts/cli/__tests__/component-validator.test.js +433 -0
- package/scripts/cli/__tests__/generator.test.js +613 -0
- package/scripts/cli/__tests__/glass-motion.test.js +256 -0
- package/scripts/cli/__tests__/integration.test.js +719 -108
- package/scripts/cli/__tests__/migrate.test.js +74 -0
- package/scripts/cli/__tests__/security.test.js +206 -0
- package/scripts/cli/__tests__/test-setup.js +3 -1
- package/scripts/cli/__tests__/theme-bridge.test.js +507 -0
- package/scripts/cli/__tests__/token-provider.test.js +361 -0
- package/scripts/cli/__tests__/utils.test.js +5 -5
- package/scripts/cli/commands/benchmark.js +105 -0
- package/scripts/cli/commands/build-theme.js +4 -1
- package/scripts/cli/commands/clean.js +109 -0
- package/scripts/cli/commands/doctor.js +88 -0
- package/scripts/cli/commands/generate.js +135 -14
- package/scripts/cli/commands/init.js +45 -18
- package/scripts/cli/commands/migrate.js +106 -0
- package/scripts/cli/commands/sync-tokens.js +206 -0
- package/scripts/cli/commands/theme-bridge.js +248 -0
- package/scripts/cli/commands/tokens.js +157 -0
- package/scripts/cli/commands/validate.js +194 -0
- package/scripts/cli/internal/ai-engine.js +156 -0
- package/scripts/cli/internal/component-validator.js +443 -0
- package/scripts/cli/internal/config-loader.js +162 -0
- package/scripts/cli/internal/filesystem.js +102 -2
- package/scripts/cli/internal/generator.js +359 -39
- package/scripts/cli/internal/glass-generator.js +398 -0
- package/scripts/cli/internal/hook-generator.js +369 -0
- package/scripts/cli/internal/hooks.js +61 -0
- package/scripts/cli/internal/itcss-generator.js +565 -0
- package/scripts/cli/internal/motion-generator.js +679 -0
- package/scripts/cli/internal/template-engine.js +301 -0
- package/scripts/cli/internal/theme-bridge.js +664 -0
- package/scripts/cli/internal/tokens/engine.js +122 -0
- package/scripts/cli/internal/tokens/provider.js +34 -0
- package/scripts/cli/internal/tokens/providers/figma.js +50 -0
- package/scripts/cli/internal/tokens/providers/style-dictionary.js +48 -0
- package/scripts/cli/internal/tokens/providers/w3c.js +48 -0
- package/scripts/cli/internal/tokens/token-provider.js +443 -0
- package/scripts/cli/internal/tokens/token-validator.js +513 -0
- package/scripts/cli/internal/validator.js +276 -0
- package/scripts/cli/internal/wizard.js +60 -6
- package/scripts/cli/mappings.js +23 -0
- package/scripts/cli/migration-tools.js +164 -94
- package/scripts/cli/plugins/style-dictionary.js +46 -0
- package/scripts/cli/templates/README.md +525 -95
- package/scripts/cli/templates/common-templates.js +40 -14
- package/scripts/cli/templates/components/react-component.ts +282 -0
- package/scripts/cli/templates/config/project-config.ts +112 -0
- package/scripts/cli/templates/hooks/use-component.ts +477 -0
- package/scripts/cli/templates/index.js +19 -4
- package/scripts/cli/templates/index.ts +171 -0
- package/scripts/cli/templates/next-templates.js +72 -0
- package/scripts/cli/templates/react-templates.js +70 -126
- package/scripts/cli/templates/scss-templates.js +35 -35
- package/scripts/cli/templates/stories/storybook-story.ts +241 -0
- package/scripts/cli/templates/styles/scss-component.ts +255 -0
- package/scripts/cli/templates/tests/vitest-test.ts +229 -0
- package/scripts/cli/templates/token-templates.js +337 -1
- package/scripts/cli/templates/tokens/token-generators.ts +1088 -0
- package/scripts/cli/templates/types/component-types.ts +145 -0
- package/scripts/cli/templates/utils/testing-utils.ts +144 -0
- package/scripts/cli/templates/vanilla-templates.js +39 -0
- package/scripts/cli/token-manager.js +8 -2
- package/scripts/cli/utils/cache-manager.js +240 -0
- package/scripts/cli/utils/detector.js +46 -0
- package/scripts/cli/utils/diagnostics.js +289 -0
- package/scripts/cli/utils/error.js +45 -3
- package/scripts/cli/utils/helpers.js +24 -0
- package/scripts/cli/utils/logger.js +1 -1
- package/scripts/cli/utils/security.js +302 -0
- package/scripts/cli/utils/telemetry.js +115 -0
- package/scripts/cli/utils/validation.js +4 -38
- package/scripts/cli/utils.js +46 -0
- package/src/components/Accordion/Accordion.stories.tsx +0 -18
- package/src/components/Accordion/Accordion.test.tsx +0 -17
- package/src/components/Accordion/Accordion.tsx +0 -4
- package/src/components/AtomixGlass/AtomixGlass.tsx +102 -2
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +125 -12
- package/src/components/AtomixGlass/PerformanceDashboard.tsx +219 -0
- package/src/components/AtomixGlass/README.md +25 -10
- package/src/components/AtomixGlass/animation-system.ts +578 -0
- package/src/components/AtomixGlass/shader-utils.ts +3 -0
- package/src/components/AtomixGlass/stories/AnimationFeatures.stories.tsx +653 -0
- package/src/components/AtomixGlass/stories/AnimationTests.stories.tsx +95 -0
- package/src/components/AtomixGlass/stories/CardExamples.stories.tsx +212 -0
- package/src/components/AtomixGlass/stories/DashboardExamples.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/EcommerceExamples.stories.tsx +410 -0
- package/src/components/AtomixGlass/stories/FormExamples.stories.tsx +436 -0
- package/src/components/AtomixGlass/stories/HeroExamples.stories.tsx +264 -0
- package/src/components/AtomixGlass/stories/InteractivePlayground.stories.tsx +247 -0
- package/src/components/AtomixGlass/stories/MobileUIExamples.stories.tsx +418 -0
- package/src/components/AtomixGlass/stories/ModalExamples.stories.tsx +402 -0
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +157 -6
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +658 -93
- package/src/components/AtomixGlass/stories/PresetGallery.stories.tsx +335 -0
- package/src/components/AtomixGlass/stories/WidgetExamples.stories.tsx +441 -0
- package/src/components/AtomixGlass/stories/argTypes.ts +384 -0
- package/src/components/AtomixGlass/stories/shared-components.tsx +91 -1
- package/src/components/AtomixGlass/stories/types.ts +127 -0
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Button/Button.stories.disabled-link.tsx +10 -0
- package/src/components/Button/Button.stories.tsx +10 -0
- package/src/components/Button/Button.test.tsx +16 -11
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +12 -12
- package/src/components/Form/Select.tsx +62 -3
- package/src/components/Modal/Modal.tsx +14 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +44 -0
- package/src/components/Slider/Slider.stories.tsx +3 -3
- package/src/components/Slider/Slider.tsx +38 -0
- package/src/components/Steps/Steps.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +77 -8
- package/src/components/Testimonial/Testimonial.tsx +1 -1
- package/src/components/TypedButton/TypedButton.stories.tsx +59 -0
- package/src/components/TypedButton/TypedButton.tsx +39 -0
- package/src/components/TypedButton/index.ts +2 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +11 -4
- package/src/lib/composables/index.ts +4 -7
- package/src/lib/composables/types.ts +45 -0
- package/src/lib/composables/useAccordion.ts +0 -7
- package/src/lib/composables/useAtomixGlass.ts +144 -5
- package/src/lib/composables/useChartExport.ts +3 -13
- package/src/lib/composables/useDropdown.ts +66 -0
- package/src/lib/composables/useFocusTrap.ts +80 -0
- package/src/lib/composables/usePerformanceMonitor.ts +448 -0
- package/src/lib/composables/useResponsiveGlass.presets.ts +192 -0
- package/src/lib/composables/useResponsiveGlass.ts +441 -0
- package/src/lib/composables/useTooltip.ts +16 -0
- package/src/lib/composables/useTypedButton.ts +66 -0
- package/src/lib/config/index.ts +62 -5
- package/src/lib/constants/components.ts +55 -0
- package/src/lib/theme/devtools/__tests__/useHistory.test.tsx +150 -0
- package/src/lib/theme/tokens/centralized-tokens.ts +120 -0
- package/src/lib/theme/utils/__tests__/domUtils.test.ts +101 -0
- package/src/lib/types/components.ts +37 -11
- package/src/lib/types/glass.ts +35 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/utils/displacement-generator.ts +1 -1
- package/src/styles/01-settings/_settings.testtypecheck.scss +53 -0
- package/src/styles/01-settings/_settings.typedbutton.scss +53 -0
- package/src/styles/06-components/_components.testbutton.scss +212 -0
- package/src/styles/06-components/_components.testtypecheck.scss +212 -0
- package/src/styles/06-components/_components.typedbutton.scss +212 -0
- package/src/styles/99-utilities/_index.scss +1 -0
- package/src/styles/99-utilities/_utilities.text.scss +1 -1
- package/src/styles/99-utilities/_utilities.touch-target.scss +36 -0
- package/src/styles/06-components/old.chart.styles.scss +0 -2788
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EcommerceExamples.stories.tsx
|
|
3
|
+
*
|
|
4
|
+
* E-commerce examples for AtomixGlass including product cards,
|
|
5
|
+
* pricing tables, shopping carts, and checkout flows.
|
|
6
|
+
*
|
|
7
|
+
* @package Atomix
|
|
8
|
+
* @component AtomixGlass
|
|
9
|
+
*/
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
13
|
+
import AtomixGlass from '../AtomixGlass';
|
|
14
|
+
import { BackgroundWrapper, backgroundImages, StoryErrorBoundary } from './shared-components';
|
|
15
|
+
import { baseArgTypes } from './argTypes';
|
|
16
|
+
|
|
17
|
+
import { Button } from '../../Button';
|
|
18
|
+
import { Badge } from '../../Badge';
|
|
19
|
+
|
|
20
|
+
const meta: Meta<typeof AtomixGlass> = {
|
|
21
|
+
title: 'Components/AtomixGlass/Examples/E-commerce Examples',
|
|
22
|
+
component: AtomixGlass,
|
|
23
|
+
parameters: {
|
|
24
|
+
layout: 'fullscreen',
|
|
25
|
+
docs: {
|
|
26
|
+
description: {
|
|
27
|
+
component:
|
|
28
|
+
'E-commerce examples demonstrating AtomixGlass for product displays, pricing tables, and shopping experiences.',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
tags: ['!autodocs'],
|
|
33
|
+
argTypes: {
|
|
34
|
+
...baseArgTypes,
|
|
35
|
+
children: { control: false },
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default meta;
|
|
40
|
+
type Story = StoryObj<typeof AtomixGlass>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Pricing Table
|
|
44
|
+
*
|
|
45
|
+
* Three-tier pricing table with monthly/yearly billing toggle and feature comparison.
|
|
46
|
+
*/
|
|
47
|
+
export const PricingTable: Story = {
|
|
48
|
+
render: () => {
|
|
49
|
+
const [billingCycle, setBillingCycle] = useState<'monthly' | 'yearly'>('monthly');
|
|
50
|
+
|
|
51
|
+
const plans = [
|
|
52
|
+
{
|
|
53
|
+
name: 'Starter',
|
|
54
|
+
description: 'Perfect for individuals',
|
|
55
|
+
price: { monthly: 9, yearly: 90 },
|
|
56
|
+
features: ['5 Projects', '10GB Storage', 'Basic Support', 'API Access'],
|
|
57
|
+
popular: false,
|
|
58
|
+
color: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Professional',
|
|
62
|
+
description: 'For growing teams',
|
|
63
|
+
price: { monthly: 29, yearly: 290 },
|
|
64
|
+
features: ['Unlimited Projects', '100GB Storage', 'Priority Support', 'Analytics'],
|
|
65
|
+
popular: true,
|
|
66
|
+
color: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'Enterprise',
|
|
70
|
+
description: 'For large organizations',
|
|
71
|
+
price: { monthly: 99, yearly: 990 },
|
|
72
|
+
features: ['Unlimited Everything', '1TB Storage', 'Dedicated Support', 'SLA'],
|
|
73
|
+
popular: false,
|
|
74
|
+
color: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<StoryErrorBoundary>
|
|
80
|
+
<BackgroundWrapper backgroundImage={backgroundImages[0]} overlay overlayOpacity={0.4}>
|
|
81
|
+
<div style={{ padding: '60px 24px', minHeight: '100vh' }}>
|
|
82
|
+
{/* Header */}
|
|
83
|
+
<div className="u-text-center u-text-white u-mb-5">
|
|
84
|
+
<Badge variant="outline-light" size="lg" className="u-mb-3">
|
|
85
|
+
💎 Pricing Plans
|
|
86
|
+
</Badge>
|
|
87
|
+
<h1 className="u-mt-0 u-text-4xl u-font-bold" style={{ fontSize: '48px' }}>
|
|
88
|
+
Choose Your Plan
|
|
89
|
+
</h1>
|
|
90
|
+
<p className="u-text-lg u-opacity-90">Start free, then scale as you grow</p>
|
|
91
|
+
|
|
92
|
+
{/* Billing Toggle */}
|
|
93
|
+
<div className="u-flex u-items-center u-justify-center u-gap-3 u-mt-4">
|
|
94
|
+
<Button
|
|
95
|
+
variant={billingCycle === 'monthly' ? 'primary' : 'outline-light'}
|
|
96
|
+
glass={{ elasticity: 0 }}
|
|
97
|
+
onClick={() => setBillingCycle('monthly')}
|
|
98
|
+
size="sm"
|
|
99
|
+
>
|
|
100
|
+
Monthly
|
|
101
|
+
</Button>
|
|
102
|
+
<Button
|
|
103
|
+
variant={billingCycle === 'yearly' ? 'primary' : 'outline-light'}
|
|
104
|
+
glass={{ elasticity: 0 }}
|
|
105
|
+
onClick={() => setBillingCycle('yearly')}
|
|
106
|
+
size="sm"
|
|
107
|
+
>
|
|
108
|
+
Yearly <Badge variant="success" className="u-ml-2">Save 17%</Badge>
|
|
109
|
+
</Button>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
{/* Pricing Cards */}
|
|
114
|
+
<div
|
|
115
|
+
style={{
|
|
116
|
+
display: 'grid',
|
|
117
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
|
|
118
|
+
gap: '24px',
|
|
119
|
+
maxWidth: '1200px',
|
|
120
|
+
margin: '0 auto',
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
{plans.map((plan, index) => (
|
|
124
|
+
<AtomixGlass
|
|
125
|
+
key={index}
|
|
126
|
+
displacementScale={plan.popular ? 100 : 40}
|
|
127
|
+
blurAmount={1}
|
|
128
|
+
saturation={plan.popular ? 180 : 130}
|
|
129
|
+
borderRadius={24}
|
|
130
|
+
mode="standard"
|
|
131
|
+
style={{ position: 'relative' }}
|
|
132
|
+
padding="32px"
|
|
133
|
+
>
|
|
134
|
+
{plan.popular && (
|
|
135
|
+
<div
|
|
136
|
+
style={{
|
|
137
|
+
position: 'absolute',
|
|
138
|
+
top: '-12px',
|
|
139
|
+
left: '50%',
|
|
140
|
+
transform: 'translateX(-50%)',
|
|
141
|
+
background: plan.color,
|
|
142
|
+
color: 'white',
|
|
143
|
+
padding: '4px 16px',
|
|
144
|
+
borderRadius: '20px',
|
|
145
|
+
fontSize: '12px',
|
|
146
|
+
fontWeight: 700,
|
|
147
|
+
textTransform: 'uppercase',
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
Most Popular
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
<div className="u-text-white">
|
|
155
|
+
<div
|
|
156
|
+
style={{
|
|
157
|
+
width: '48px',
|
|
158
|
+
height: '48px',
|
|
159
|
+
borderRadius: '16px',
|
|
160
|
+
background: plan.color,
|
|
161
|
+
marginBottom: '16px',
|
|
162
|
+
display: 'flex',
|
|
163
|
+
alignItems: 'center',
|
|
164
|
+
justifyContent: 'center',
|
|
165
|
+
fontSize: '24px',
|
|
166
|
+
}}
|
|
167
|
+
aria-hidden="true"
|
|
168
|
+
>
|
|
169
|
+
{index === 0 ? '🚀' : index === 1 ? '⭐' : '👑'}
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<h3 className="u-m-0 u-text-xl u-font-bold">{plan.name}</h3>
|
|
173
|
+
<p className="u-m-0 u-text-sm u-opacity-80 u-mb-3">{plan.description}</p>
|
|
174
|
+
|
|
175
|
+
<div className="u-mb-4">
|
|
176
|
+
<span className="u-text-4xl u-font-bold">${plan.price[billingCycle]}</span>
|
|
177
|
+
<span className="u-text-sm u-opacity-70">
|
|
178
|
+
/{billingCycle === 'monthly' ? 'month' : 'year'}
|
|
179
|
+
</span>
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
<Button
|
|
183
|
+
variant={plan.popular ? 'primary' : 'outline-light'}
|
|
184
|
+
glass={{ elasticity: 0 }}
|
|
185
|
+
className="u-block u-w-full u-mb-4"
|
|
186
|
+
>
|
|
187
|
+
Get Started
|
|
188
|
+
</Button>
|
|
189
|
+
|
|
190
|
+
<div
|
|
191
|
+
style={{
|
|
192
|
+
borderTop: '1px solid rgba(255,255,255,0.1)',
|
|
193
|
+
paddingTop: '16px',
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<p className="u-text-xs u-font-semibold u-text-uppercase u-mb-2 u-opacity-70">
|
|
197
|
+
What's Included
|
|
198
|
+
</p>
|
|
199
|
+
<ul className="u-m-0 u-p-0" style={{ listStyle: 'none' }}>
|
|
200
|
+
{plan.features.map((feature, idx) => (
|
|
201
|
+
<li key={idx} className="u-flex u-items-center u-gap-2 u-mb-2 u-text-sm">
|
|
202
|
+
<span style={{ color: '#10b981', fontWeight: 700 }}>✓</span>
|
|
203
|
+
{feature}
|
|
204
|
+
</li>
|
|
205
|
+
))}
|
|
206
|
+
</ul>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
</AtomixGlass>
|
|
210
|
+
))}
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</BackgroundWrapper>
|
|
214
|
+
</StoryErrorBoundary>
|
|
215
|
+
);
|
|
216
|
+
},
|
|
217
|
+
parameters: {
|
|
218
|
+
docs: {
|
|
219
|
+
description: {
|
|
220
|
+
story:
|
|
221
|
+
'Three-tier pricing table with billing cycle toggle, feature lists, and highlighted popular plan.',
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Product Card
|
|
229
|
+
*
|
|
230
|
+
* Modern product card with image, rating, price, and add to cart functionality.
|
|
231
|
+
*/
|
|
232
|
+
export const ProductCard: Story = {
|
|
233
|
+
render: () => (
|
|
234
|
+
<StoryErrorBoundary>
|
|
235
|
+
<BackgroundWrapper backgroundImage={backgroundImages[6]} overlay overlayOpacity={0.3}>
|
|
236
|
+
<div
|
|
237
|
+
style={{
|
|
238
|
+
display: 'grid',
|
|
239
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))',
|
|
240
|
+
gap: '24px',
|
|
241
|
+
padding: '40px',
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
{[
|
|
245
|
+
{ name: 'Premium Headphones', price: 299, rating: 4.8, reviews: 256, image: '🎧', badge: 'New' },
|
|
246
|
+
{ name: 'Smart Watch Pro', price: 449, rating: 4.9, reviews: 512, image: '⌚', badge: 'Best Seller' },
|
|
247
|
+
{ name: 'Wireless Earbuds', price: 179, rating: 4.7, reviews: 189, image: '🎵', badge: null },
|
|
248
|
+
].map((product, index) => (
|
|
249
|
+
<AtomixGlass
|
|
250
|
+
key={index}
|
|
251
|
+
displacementScale={60}
|
|
252
|
+
blurAmount={0.75}
|
|
253
|
+
saturation={140}
|
|
254
|
+
borderRadius={20}
|
|
255
|
+
mode="standard"
|
|
256
|
+
>
|
|
257
|
+
<div className="u-text-white">
|
|
258
|
+
{product.badge && (
|
|
259
|
+
<Badge variant="primary" className="u-mb-3">
|
|
260
|
+
{product.badge}
|
|
261
|
+
</Badge>
|
|
262
|
+
)}
|
|
263
|
+
|
|
264
|
+
<div
|
|
265
|
+
style={{
|
|
266
|
+
height: '200px',
|
|
267
|
+
borderRadius: '16px',
|
|
268
|
+
background: 'linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05))',
|
|
269
|
+
display: 'flex',
|
|
270
|
+
alignItems: 'center',
|
|
271
|
+
justifyContent: 'center',
|
|
272
|
+
fontSize: '80px',
|
|
273
|
+
marginBottom: '20px',
|
|
274
|
+
}}
|
|
275
|
+
aria-label={product.name}
|
|
276
|
+
>
|
|
277
|
+
{product.image}
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<h3 className="u-m-0 u-text-lg u-font-bold u-mb-2">{product.name}</h3>
|
|
281
|
+
|
|
282
|
+
<div className="u-flex u-items-center u-gap-2 u-mb-3">
|
|
283
|
+
<div style={{ color: '#fbbf24', fontSize: '16px' }}>
|
|
284
|
+
{'★'.repeat(Math.floor(product.rating))}
|
|
285
|
+
{'☆'.repeat(5 - Math.floor(product.rating))}
|
|
286
|
+
</div>
|
|
287
|
+
<span className="u-text-sm u-opacity-80">
|
|
288
|
+
{product.rating} ({product.reviews} reviews)
|
|
289
|
+
</span>
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
<div className="u-flex u-items-center u-justify-between">
|
|
293
|
+
<span className="u-text-2xl u-font-bold">${product.price}</span>
|
|
294
|
+
<Button glass size="sm" variant="primary">
|
|
295
|
+
Add to Cart
|
|
296
|
+
</Button>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
</AtomixGlass>
|
|
300
|
+
))}
|
|
301
|
+
</div>
|
|
302
|
+
</BackgroundWrapper>
|
|
303
|
+
</StoryErrorBoundary>
|
|
304
|
+
),
|
|
305
|
+
parameters: {
|
|
306
|
+
docs: {
|
|
307
|
+
description: {
|
|
308
|
+
story:
|
|
309
|
+
'Product cards with images, ratings, prices, and add to cart buttons in a responsive grid layout.',
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Shopping Cart Summary
|
|
317
|
+
*
|
|
318
|
+
* Cart summary with items, quantities, and total calculation.
|
|
319
|
+
*/
|
|
320
|
+
export const ShoppingCart: Story = {
|
|
321
|
+
render: () => {
|
|
322
|
+
const [items] = useState([
|
|
323
|
+
{ id: 1, name: 'Premium Headphones', price: 299, quantity: 1, image: '🎧' },
|
|
324
|
+
{ id: 2, name: 'USB-C Cable', price: 19, quantity: 2, image: '🔌' },
|
|
325
|
+
{ id: 3, name: 'Phone Case', price: 39, quantity: 1, image: '📱' },
|
|
326
|
+
]);
|
|
327
|
+
|
|
328
|
+
const total = items.reduce((sum, item) => sum + item.price * item.quantity, 0);
|
|
329
|
+
|
|
330
|
+
return (
|
|
331
|
+
<StoryErrorBoundary>
|
|
332
|
+
<BackgroundWrapper backgroundImage={backgroundImages[2]} overlay overlayOpacity={0.4}>
|
|
333
|
+
<div style={{ maxWidth: '500px' }} className="u-mx-auto">
|
|
334
|
+
<AtomixGlass
|
|
335
|
+
displacementScale={65}
|
|
336
|
+
blurAmount={0.75}
|
|
337
|
+
saturation={140}
|
|
338
|
+
borderRadius={24}
|
|
339
|
+
mode="standard"
|
|
340
|
+
padding="32px"
|
|
341
|
+
>
|
|
342
|
+
<div className="u-text-white">
|
|
343
|
+
<h2 className="u-mt-0 u-text-2xl u-font-bold u-mb-4">Shopping Cart</h2>
|
|
344
|
+
|
|
345
|
+
<div className="u-divide-y" style={{ borderColor: 'rgba(255,255,255,0.1)' }}>
|
|
346
|
+
{items.map((item) => (
|
|
347
|
+
<div key={item.id} className="u-py-3 u-flex u-items-center u-gap-3">
|
|
348
|
+
<div
|
|
349
|
+
style={{
|
|
350
|
+
width: '60px',
|
|
351
|
+
height: '60px',
|
|
352
|
+
borderRadius: '12px',
|
|
353
|
+
background: 'rgba(255,255,255,0.1)',
|
|
354
|
+
display: 'flex',
|
|
355
|
+
alignItems: 'center',
|
|
356
|
+
justifyContent: 'center',
|
|
357
|
+
fontSize: '28px',
|
|
358
|
+
flexShrink: 0,
|
|
359
|
+
}}
|
|
360
|
+
aria-hidden="true"
|
|
361
|
+
>
|
|
362
|
+
{item.image}
|
|
363
|
+
</div>
|
|
364
|
+
<div className="u-flex-1">
|
|
365
|
+
<p className="u-m-0 u-font-medium">{item.name}</p>
|
|
366
|
+
<p className="u-m-0 u-text-sm u-opacity-70">
|
|
367
|
+
${item.price} × {item.quantity}
|
|
368
|
+
</p>
|
|
369
|
+
</div>
|
|
370
|
+
<p className="u-m-0 u-font-semibold">
|
|
371
|
+
${(item.price * item.quantity).toFixed(2)}
|
|
372
|
+
</p>
|
|
373
|
+
</div>
|
|
374
|
+
))}
|
|
375
|
+
</div>
|
|
376
|
+
|
|
377
|
+
<div
|
|
378
|
+
style={{
|
|
379
|
+
borderTop: '2px solid rgba(255,255,255,0.1)',
|
|
380
|
+
paddingTop: '20px',
|
|
381
|
+
marginTop: '20px',
|
|
382
|
+
}}
|
|
383
|
+
>
|
|
384
|
+
<div className="u-flex u-items-center u-justify-between u-mb-4">
|
|
385
|
+
<span className="u-text-lg u-font-semibold">Total</span>
|
|
386
|
+
<span className="u-text-3xl u-font-bold">${total.toFixed(2)}</span>
|
|
387
|
+
</div>
|
|
388
|
+
<Button variant="primary" glass={{ elasticity: 0 }} size="lg" className="u-block u-w-full">
|
|
389
|
+
Checkout
|
|
390
|
+
</Button>
|
|
391
|
+
<p className="u-text-center u-text-xs u-opacity-70 u-mt-3">
|
|
392
|
+
Free shipping on orders over $500
|
|
393
|
+
</p>
|
|
394
|
+
</div>
|
|
395
|
+
</div>
|
|
396
|
+
</AtomixGlass>
|
|
397
|
+
</div>
|
|
398
|
+
</BackgroundWrapper>
|
|
399
|
+
</StoryErrorBoundary>
|
|
400
|
+
);
|
|
401
|
+
},
|
|
402
|
+
parameters: {
|
|
403
|
+
docs: {
|
|
404
|
+
description: {
|
|
405
|
+
story:
|
|
406
|
+
'Shopping cart summary with product items, quantities, subtotal calculations, and checkout button.',
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
};
|