@faststore/core 0.3.6 → 0.3.7
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/.storybook/preview.js +0 -4
- package/CHANGELOG.md +2 -0
- package/README.md +13 -11
- package/cypress/integration/analytics.test.js +1 -1
- package/cypress/integration/search.test.js +1 -1
- package/package.json +17 -16
- package/src/components/cart/CartItem/CartItem.tsx +4 -4
- package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +3 -3
- package/src/components/cart/CartSidebar/CartSidebar.tsx +14 -11
- package/src/components/cart/CartToggle/CartToggle.tsx +6 -4
- package/src/components/cart/EmptyCart/EmptyCart.tsx +4 -3
- package/src/components/common/Footer/Footer.tsx +9 -5
- package/src/components/common/Footer/FooterLinks.tsx +1 -1
- package/src/components/common/Navbar/Navbar.tsx +4 -6
- package/src/components/common/Navbar/NavbarSlider.tsx +3 -5
- package/src/components/common/Navbar/navbar.module.scss +1 -1
- package/src/components/product/OutOfStock/OutOfStock.tsx +5 -5
- package/src/components/product/ProductCard/ProductCard.stories.mdx +14 -14
- package/src/components/product/ProductCard/ProductCard.tsx +10 -9
- package/src/components/regionalization/Regionalization.stories.mdx +2 -6
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +3 -3
- package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +4 -3
- package/src/components/regionalization/RegionalizationInput/RegionalizationInput.tsx +2 -2
- package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +3 -2
- package/src/components/search/Filter/Facets.tsx +9 -6
- package/src/components/search/Filter/FilterSlider.tsx +6 -6
- package/src/components/search/SearchHistory/SearchHistory.tsx +4 -5
- package/src/components/search/SearchInput/search-input.module.scss +1 -14
- package/src/components/search/SearchTop/SearchTop.tsx +4 -5
- package/src/components/search/Sort/Sort.tsx +2 -3
- package/src/components/sections/BannerText/banner-text.module.scss +6 -6
- package/src/components/sections/Incentives/Incentives.tsx +1 -1
- package/src/components/sections/Newsletter/Newsletter.tsx +10 -8
- package/src/components/sections/Newsletter/newsletter.module.scss +1 -1
- package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +1 -1
- package/src/components/sections/ProducDetailsContent/product-details-content.module.scss +0 -9
- package/src/components/sections/ProductDetails/ProductDetails.tsx +11 -5
- package/src/components/sections/ProductDetails/product-details.module.scss +1 -1
- package/src/components/sections/ProductGallery/ProductGallery.tsx +4 -3
- package/src/components/sections/ScrollToTopButton/ScrollToTopButton.tsx +5 -4
- package/src/components/ui/Alert/Alert.tsx +7 -4
- package/src/components/ui/Button/Button.stories.mdx +3 -44
- package/src/components/ui/Button/ButtonLink/ButtonLink.tsx +2 -1
- package/src/components/ui/Button/button.module.scss +0 -381
- package/src/components/ui/Button/index.ts +0 -3
- package/src/components/ui/Gift/Gift.tsx +2 -2
- package/src/components/ui/ImageGallery/ImageGallerySelector.tsx +5 -5
- package/src/components/ui/ImageGallery/image-gallery-selector.module.scss +6 -0
- package/src/components/ui/Link/Link.tsx +19 -34
- package/src/components/ui/PriceRange/PriceRange.tsx +6 -4
- package/src/components/ui/PriceRange/price-range.module.scss +1 -1
- package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +13 -15
- package/src/components/ui/QuantitySelector/quantity-selector.module.scss +21 -26
- package/src/components/ui/ShippingSimulation/ShippingSimulation.stories.mdx +1 -1
- package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +8 -3
- package/src/components/ui/SlideOver/SlideOver.stories.mdx +3 -3
- package/src/pages/_app.tsx +3 -4
- package/src/styles/global/components.scss +0 -3
- package/src/styles/global/storybook-components.scss +3 -3
- package/src/styles/global/utilities.scss +12 -5
- package/src/components/ui/Badge/Badge.stories.mdx +0 -465
- package/src/components/ui/Badge/Badge.tsx +0 -76
- package/src/components/ui/Badge/DiscountBadge.stories.mdx +0 -191
- package/src/components/ui/Badge/DiscountBadge.tsx +0 -57
- package/src/components/ui/Badge/badge.module.scss +0 -252
- package/src/components/ui/Badge/index.ts +0 -4
- package/src/components/ui/Button/Button.tsx +0 -85
- package/src/components/ui/Button/ButtonBuy/ButtonBuy.tsx +0 -24
- package/src/components/ui/Button/ButtonBuy/index.ts +0 -1
- package/src/components/ui/Checkbox/Checkbox.stories.mdx +0 -268
- package/src/components/ui/Checkbox/Checkbox.tsx +0 -20
- package/src/components/ui/Checkbox/checkbox.module.scss +0 -157
- package/src/components/ui/Checkbox/index.ts +0 -2
- package/src/components/ui/InputText/InputText.stories.mdx +0 -311
- package/src/components/ui/InputText/InputText.tsx +0 -128
- package/src/components/ui/InputText/index.ts +0 -2
- package/src/components/ui/InputText/input-text.module.scss +0 -168
- package/src/components/ui/Link/link.module.scss +0 -98
- package/src/components/ui/Radio/Radio.stories.mdx +0 -237
- package/src/components/ui/Radio/Radio.tsx +0 -36
- package/src/components/ui/Radio/index.ts +0 -2
- package/src/components/ui/Radio/radio.module.scss +0 -122
- package/src/components/ui/Select/Select.stories.mdx +0 -168
- package/src/components/ui/Select/Select.tsx +0 -70
- package/src/components/ui/Select/index.ts +0 -2
- package/src/components/ui/Select/select.module.scss +0 -85
- package/src/components/ui/SlideOver/overlay.scss +0 -14
- package/src/styles/global/resets.scss +0 -48
- package/src/styles/global/tokens.scss +0 -276
- package/src/styles/global/typography.scss +0 -66
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import { Badge } from '.'
|
|
4
|
-
import { DiscountBadge } from '.'
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
TokenTable,
|
|
8
|
-
TokenRow,
|
|
9
|
-
TokenDivider,
|
|
10
|
-
SectionList,
|
|
11
|
-
SectionItem,
|
|
12
|
-
} from 'src/../.storybook/components'
|
|
13
|
-
|
|
14
|
-
<Meta
|
|
15
|
-
title="Molecules/Badge/Default"
|
|
16
|
-
component={Badge}
|
|
17
|
-
argTypes={{
|
|
18
|
-
onClose: { table: { disable: true } },
|
|
19
|
-
children: {
|
|
20
|
-
name: 'content',
|
|
21
|
-
},
|
|
22
|
-
variant: {
|
|
23
|
-
options: [
|
|
24
|
-
'info',
|
|
25
|
-
'highlighted',
|
|
26
|
-
'success',
|
|
27
|
-
'neutral',
|
|
28
|
-
'warning',
|
|
29
|
-
'danger',
|
|
30
|
-
],
|
|
31
|
-
control: { type: 'radio' },
|
|
32
|
-
},
|
|
33
|
-
}}
|
|
34
|
-
/>
|
|
35
|
-
|
|
36
|
-
export const Template = ({ children, ...args }) => (
|
|
37
|
-
<Badge {...args}>{children}</Badge>
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
<header>
|
|
41
|
-
|
|
42
|
-
# Badge
|
|
43
|
-
|
|
44
|
-
Badges are status descriptors used to emphasize an item's state.
|
|
45
|
-
|
|
46
|
-
</header>
|
|
47
|
-
|
|
48
|
-
## Overview
|
|
49
|
-
|
|
50
|
-
The `Badge` component uses [FastStore UI Badge](https://www.faststore.dev/reference/ui/atoms/Badge) as base.
|
|
51
|
-
|
|
52
|
-
<Canvas className="sbdocs-vertically-center">
|
|
53
|
-
<Story
|
|
54
|
-
name="overview-neutral"
|
|
55
|
-
args={{
|
|
56
|
-
children: 'Neutral',
|
|
57
|
-
big: false,
|
|
58
|
-
actionable: false,
|
|
59
|
-
variant: 'neutral',
|
|
60
|
-
}}
|
|
61
|
-
>
|
|
62
|
-
{Template.bind({})}
|
|
63
|
-
</Story>
|
|
64
|
-
<Story
|
|
65
|
-
name="overview-info"
|
|
66
|
-
args={{
|
|
67
|
-
children: 'Info',
|
|
68
|
-
big: false,
|
|
69
|
-
actionable: false,
|
|
70
|
-
variant: 'info',
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
{Template.bind({})}
|
|
74
|
-
</Story>
|
|
75
|
-
<Story
|
|
76
|
-
name="overview-highlighted"
|
|
77
|
-
args={{
|
|
78
|
-
children: 'Highlighted',
|
|
79
|
-
big: false,
|
|
80
|
-
actionable: false,
|
|
81
|
-
variant: 'highlighted',
|
|
82
|
-
}}
|
|
83
|
-
>
|
|
84
|
-
{Template.bind({})}
|
|
85
|
-
</Story>
|
|
86
|
-
<Story
|
|
87
|
-
name="overview-success"
|
|
88
|
-
args={{
|
|
89
|
-
children: 'Success',
|
|
90
|
-
big: false,
|
|
91
|
-
actionable: false,
|
|
92
|
-
variant: 'success',
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
{Template.bind({})}
|
|
96
|
-
</Story>
|
|
97
|
-
<Story
|
|
98
|
-
name="overview-warning"
|
|
99
|
-
args={{
|
|
100
|
-
children: 'Warning',
|
|
101
|
-
big: false,
|
|
102
|
-
actionable: false,
|
|
103
|
-
variant: 'warning',
|
|
104
|
-
}}
|
|
105
|
-
>
|
|
106
|
-
{Template.bind({})}
|
|
107
|
-
</Story>
|
|
108
|
-
<Story
|
|
109
|
-
name="overview-danger"
|
|
110
|
-
args={{
|
|
111
|
-
children: 'Danger',
|
|
112
|
-
big: false,
|
|
113
|
-
actionable: false,
|
|
114
|
-
variant: 'danger',
|
|
115
|
-
}}
|
|
116
|
-
>
|
|
117
|
-
{Template.bind({})}
|
|
118
|
-
</Story>
|
|
119
|
-
<Story
|
|
120
|
-
name="overview-actionable"
|
|
121
|
-
args={{
|
|
122
|
-
children: 'Big & Actionable',
|
|
123
|
-
big: true,
|
|
124
|
-
actionable: true,
|
|
125
|
-
variant: 'success',
|
|
126
|
-
}}
|
|
127
|
-
>
|
|
128
|
-
{Template.bind({})}
|
|
129
|
-
</Story>
|
|
130
|
-
</Canvas>
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Usage
|
|
135
|
-
|
|
136
|
-
`import Badge from '../components/ui/Badge'`
|
|
137
|
-
|
|
138
|
-
<Canvas>
|
|
139
|
-
<Story
|
|
140
|
-
name="default"
|
|
141
|
-
args={{
|
|
142
|
-
children: 'New arrival',
|
|
143
|
-
big: false,
|
|
144
|
-
actionable: false,
|
|
145
|
-
variant: 'info',
|
|
146
|
-
}}
|
|
147
|
-
>
|
|
148
|
-
{Template.bind({})}
|
|
149
|
-
</Story>
|
|
150
|
-
</Canvas>
|
|
151
|
-
|
|
152
|
-
<ArgsTable story="default" />
|
|
153
|
-
|
|
154
|
-
<TokenTable>
|
|
155
|
-
<TokenRow
|
|
156
|
-
token="--fs-badge-padding"
|
|
157
|
-
value="var(--fs-spacing-0) var(--fs-spacing-2)"
|
|
158
|
-
/>
|
|
159
|
-
<TokenDivider />
|
|
160
|
-
<TokenRow
|
|
161
|
-
token="--fs-badge-border-radius"
|
|
162
|
-
value="var(--fs-border-radius-pill)"
|
|
163
|
-
/>
|
|
164
|
-
<TokenRow token="--fs-badge-border-width" value="var(--fs-border-width)" />
|
|
165
|
-
<TokenRow token="--fs-badge-border-color" value="transparent" isColor />
|
|
166
|
-
<TokenDivider />
|
|
167
|
-
<TokenRow
|
|
168
|
-
token="--fs-badge-bkg-color"
|
|
169
|
-
value="var(--fs-color-neutral-bkg)"
|
|
170
|
-
isColor
|
|
171
|
-
/>
|
|
172
|
-
<TokenDivider />
|
|
173
|
-
<TokenRow
|
|
174
|
-
token="--fs-badge-text-color"
|
|
175
|
-
value="var(--fs-color-text)"
|
|
176
|
-
isColor
|
|
177
|
-
/>
|
|
178
|
-
<TokenRow token="--fs-badge-text-size" value="var(--fs-text-size-tiny)" />
|
|
179
|
-
<TokenRow token="--fs-badge-text-weight" value="var(--fs-text-weight-bold)" />
|
|
180
|
-
<TokenDivider />
|
|
181
|
-
<TokenRow
|
|
182
|
-
token="--fs-badge-transition-function"
|
|
183
|
-
value="var(--fs-transition-function)"
|
|
184
|
-
/>
|
|
185
|
-
<TokenRow
|
|
186
|
-
token="--fs-badge-transition-property"
|
|
187
|
-
value="var(--fs-transition-property)"
|
|
188
|
-
/>
|
|
189
|
-
<TokenRow
|
|
190
|
-
token="--fs-badge-transition-timing"
|
|
191
|
-
value="var(--fs-transition-timing)"
|
|
192
|
-
/>
|
|
193
|
-
</TokenTable>
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## Variants
|
|
198
|
-
|
|
199
|
-
### Actionable
|
|
200
|
-
|
|
201
|
-
<Canvas>
|
|
202
|
-
<Story
|
|
203
|
-
name="badge-actionable"
|
|
204
|
-
args={{
|
|
205
|
-
children: 'Badge Actionable',
|
|
206
|
-
big: true,
|
|
207
|
-
actionable: true,
|
|
208
|
-
variant: 'neutral',
|
|
209
|
-
}}
|
|
210
|
-
>
|
|
211
|
-
{Template.bind({})}
|
|
212
|
-
</Story>
|
|
213
|
-
</Canvas>
|
|
214
|
-
|
|
215
|
-
### Big
|
|
216
|
-
|
|
217
|
-
<Canvas>
|
|
218
|
-
<Story
|
|
219
|
-
name="badge-big"
|
|
220
|
-
args={{
|
|
221
|
-
children: 'Badge Big',
|
|
222
|
-
big: true,
|
|
223
|
-
actionable: false,
|
|
224
|
-
variant: 'neutral',
|
|
225
|
-
}}
|
|
226
|
-
>
|
|
227
|
-
{Template.bind({})}
|
|
228
|
-
</Story>
|
|
229
|
-
</Canvas>
|
|
230
|
-
|
|
231
|
-
<TokenTable>
|
|
232
|
-
<TokenRow
|
|
233
|
-
token="--fs-badge-big-text-size"
|
|
234
|
-
value="var(--fs-text-size-legend)"
|
|
235
|
-
/>
|
|
236
|
-
<TokenRow
|
|
237
|
-
token="--fs-badge-big-padding"
|
|
238
|
-
value="var(--fs-spacing-1) var(--fs-spacing-2)"
|
|
239
|
-
/>
|
|
240
|
-
</TokenTable>
|
|
241
|
-
|
|
242
|
-
### Neutral
|
|
243
|
-
|
|
244
|
-
<Canvas>
|
|
245
|
-
<Story
|
|
246
|
-
name="badge-neutral"
|
|
247
|
-
args={{
|
|
248
|
-
children: 'Badge Neutral',
|
|
249
|
-
big: false,
|
|
250
|
-
actionable: false,
|
|
251
|
-
variant: 'neutral',
|
|
252
|
-
}}
|
|
253
|
-
>
|
|
254
|
-
{Template.bind({})}
|
|
255
|
-
</Story>
|
|
256
|
-
</Canvas>
|
|
257
|
-
|
|
258
|
-
<TokenTable>
|
|
259
|
-
<TokenRow
|
|
260
|
-
token="--fs-badge-neutral-bkg-color"
|
|
261
|
-
value="var(--fs-color-neutral-bkg)"
|
|
262
|
-
isColor
|
|
263
|
-
/>
|
|
264
|
-
<TokenRow
|
|
265
|
-
token="--fs-badge-neutral-text-color"
|
|
266
|
-
value="var(--fs-badge-text-color)"
|
|
267
|
-
globalValue="var(--fs-color-text)"
|
|
268
|
-
isColor
|
|
269
|
-
/>
|
|
270
|
-
<TokenRow
|
|
271
|
-
token="--fs-badge-neutral-border-color"
|
|
272
|
-
value="var(--fs-color-neutral-bkg)"
|
|
273
|
-
isColor
|
|
274
|
-
/>
|
|
275
|
-
</TokenTable>
|
|
276
|
-
|
|
277
|
-
### Success
|
|
278
|
-
|
|
279
|
-
<Canvas>
|
|
280
|
-
<Story
|
|
281
|
-
name="badge-success"
|
|
282
|
-
args={{
|
|
283
|
-
children: 'Badge Success',
|
|
284
|
-
big: false,
|
|
285
|
-
actionable: false,
|
|
286
|
-
variant: 'success',
|
|
287
|
-
}}
|
|
288
|
-
>
|
|
289
|
-
{Template.bind({})}
|
|
290
|
-
</Story>
|
|
291
|
-
</Canvas>
|
|
292
|
-
|
|
293
|
-
<TokenTable>
|
|
294
|
-
<TokenRow
|
|
295
|
-
token="--fs-badge-success-bkg-color"
|
|
296
|
-
value="var(--fs-color-success-bkg)"
|
|
297
|
-
isColor
|
|
298
|
-
/>
|
|
299
|
-
<TokenRow
|
|
300
|
-
token="--fs-badge-success-text-color"
|
|
301
|
-
value="var(--fs-badge-text-color)"
|
|
302
|
-
globalValue="var(--fs-color-text)"
|
|
303
|
-
isColor
|
|
304
|
-
/>
|
|
305
|
-
<TokenRow
|
|
306
|
-
token="--fs-badge-success-border-color"
|
|
307
|
-
value="var(--fs-color-success-bkg)"
|
|
308
|
-
isColor
|
|
309
|
-
/>
|
|
310
|
-
</TokenTable>
|
|
311
|
-
|
|
312
|
-
### Highlighted
|
|
313
|
-
|
|
314
|
-
<Canvas>
|
|
315
|
-
<Story
|
|
316
|
-
name="badge-highlighted"
|
|
317
|
-
args={{
|
|
318
|
-
children: 'Badge Highlighted',
|
|
319
|
-
big: false,
|
|
320
|
-
actionable: false,
|
|
321
|
-
variant: 'highlighted',
|
|
322
|
-
}}
|
|
323
|
-
>
|
|
324
|
-
{Template.bind({})}
|
|
325
|
-
</Story>
|
|
326
|
-
</Canvas>
|
|
327
|
-
|
|
328
|
-
<TokenTable>
|
|
329
|
-
<TokenRow
|
|
330
|
-
token="--fs-badge-highlighted-bkg-color"
|
|
331
|
-
value="var(--fs-color-highlighted-bkg)"
|
|
332
|
-
isColor
|
|
333
|
-
/>
|
|
334
|
-
<TokenRow
|
|
335
|
-
token="--fs-badge-highlighted-text-color"
|
|
336
|
-
value="var(--fs-color-highlighted-text)"
|
|
337
|
-
isColor
|
|
338
|
-
/>
|
|
339
|
-
<TokenRow
|
|
340
|
-
token="--fs-badge-highlighted-border-color"
|
|
341
|
-
value="var(--fs-color-highlighted-bkg)"
|
|
342
|
-
isColor
|
|
343
|
-
/>
|
|
344
|
-
</TokenTable>
|
|
345
|
-
|
|
346
|
-
### Info
|
|
347
|
-
|
|
348
|
-
<Canvas>
|
|
349
|
-
<Story
|
|
350
|
-
name="badge-info"
|
|
351
|
-
args={{
|
|
352
|
-
children: 'Badge Info',
|
|
353
|
-
big: false,
|
|
354
|
-
actionable: false,
|
|
355
|
-
variant: 'info',
|
|
356
|
-
}}
|
|
357
|
-
>
|
|
358
|
-
{Template.bind({})}
|
|
359
|
-
</Story>
|
|
360
|
-
</Canvas>
|
|
361
|
-
|
|
362
|
-
<TokenTable>
|
|
363
|
-
<TokenRow
|
|
364
|
-
token="--fs-badge-info-bkg-color"
|
|
365
|
-
value="var(--fs-color-info-bkg)"
|
|
366
|
-
isColor
|
|
367
|
-
/>
|
|
368
|
-
<TokenRow
|
|
369
|
-
token="--fs-badge-info-text-color"
|
|
370
|
-
value="var(--fs-color-info-text)"
|
|
371
|
-
isColor
|
|
372
|
-
/>
|
|
373
|
-
<TokenRow
|
|
374
|
-
token="--fs-badge-info-border-color"
|
|
375
|
-
value="var(--fs-color-info-bkg)"
|
|
376
|
-
isColor
|
|
377
|
-
/>
|
|
378
|
-
</TokenTable>
|
|
379
|
-
|
|
380
|
-
### Warning
|
|
381
|
-
|
|
382
|
-
<Canvas>
|
|
383
|
-
<Story
|
|
384
|
-
name="badge-warning"
|
|
385
|
-
args={{
|
|
386
|
-
children: 'Badge Warning',
|
|
387
|
-
big: false,
|
|
388
|
-
actionable: false,
|
|
389
|
-
variant: 'warning',
|
|
390
|
-
}}
|
|
391
|
-
>
|
|
392
|
-
{Template.bind({})}
|
|
393
|
-
</Story>
|
|
394
|
-
</Canvas>
|
|
395
|
-
|
|
396
|
-
<TokenTable>
|
|
397
|
-
<TokenRow
|
|
398
|
-
token="--fs-badge-warning-bkg-color"
|
|
399
|
-
value="var(--fs-color-warning-bkg)"
|
|
400
|
-
isColor
|
|
401
|
-
/>
|
|
402
|
-
<TokenRow
|
|
403
|
-
token="--fs-badge-warning-text-color"
|
|
404
|
-
value="var(--fs-color-warning-text)"
|
|
405
|
-
isColor
|
|
406
|
-
/>
|
|
407
|
-
<TokenRow
|
|
408
|
-
token="--fs-badge-warning-border-color"
|
|
409
|
-
value="var(--fs-color-warning-bkg)"
|
|
410
|
-
isColor
|
|
411
|
-
/>
|
|
412
|
-
</TokenTable>
|
|
413
|
-
|
|
414
|
-
### Danger
|
|
415
|
-
|
|
416
|
-
<Canvas>
|
|
417
|
-
<Story
|
|
418
|
-
name="badge-danger"
|
|
419
|
-
args={{
|
|
420
|
-
children: 'Badge Danger',
|
|
421
|
-
big: false,
|
|
422
|
-
actionable: false,
|
|
423
|
-
variant: 'danger',
|
|
424
|
-
}}
|
|
425
|
-
>
|
|
426
|
-
{Template.bind({})}
|
|
427
|
-
</Story>
|
|
428
|
-
</Canvas>
|
|
429
|
-
|
|
430
|
-
<TokenTable>
|
|
431
|
-
<TokenRow
|
|
432
|
-
token="--fs-badge-danger-bkg-color"
|
|
433
|
-
value="var(--fs-color-danger-bkg)"
|
|
434
|
-
isColor
|
|
435
|
-
/>
|
|
436
|
-
<TokenRow
|
|
437
|
-
token="--fs-badge-danger-text-color"
|
|
438
|
-
value="var(--fs-badge-text-color)"
|
|
439
|
-
globalValue="var(--fs-color-text)"
|
|
440
|
-
isColor
|
|
441
|
-
/>
|
|
442
|
-
<TokenRow
|
|
443
|
-
token="--fs-badge-danger-border-color"
|
|
444
|
-
value="var(--fs-color-danger-bkg)"
|
|
445
|
-
isColor
|
|
446
|
-
/>
|
|
447
|
-
</TokenTable>
|
|
448
|
-
|
|
449
|
-
---
|
|
450
|
-
|
|
451
|
-
## Related Components
|
|
452
|
-
|
|
453
|
-
<SectionList>
|
|
454
|
-
<SectionItem
|
|
455
|
-
title="Discount Badge"
|
|
456
|
-
actionPath="../?path=/docs/molecules-badge-discountbadge--overview-default"
|
|
457
|
-
description={
|
|
458
|
-
<>
|
|
459
|
-
A <code>Badge</code> used to show product discounts.
|
|
460
|
-
</>
|
|
461
|
-
}
|
|
462
|
-
>
|
|
463
|
-
<DiscountBadge listPrice="45" spotPrice="40" />
|
|
464
|
-
</SectionItem>
|
|
465
|
-
</SectionList>
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Badge as UIBadge } from '@faststore/ui'
|
|
2
|
-
import type { ReactNode } from 'react'
|
|
3
|
-
|
|
4
|
-
import Button from 'src/components/ui/Button'
|
|
5
|
-
import Icon from 'src/components/ui/Icon'
|
|
6
|
-
|
|
7
|
-
import styles from './badge.module.scss'
|
|
8
|
-
|
|
9
|
-
export type BadgeVariants =
|
|
10
|
-
| 'info'
|
|
11
|
-
| 'highlighted'
|
|
12
|
-
| 'success'
|
|
13
|
-
| 'neutral'
|
|
14
|
-
| 'warning'
|
|
15
|
-
| 'danger'
|
|
16
|
-
|
|
17
|
-
type ActionableBadge =
|
|
18
|
-
| {
|
|
19
|
-
actionable: true
|
|
20
|
-
onClose?: () => void
|
|
21
|
-
}
|
|
22
|
-
| {
|
|
23
|
-
actionable?: false
|
|
24
|
-
onClose?: never
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type BadgeProps = {
|
|
28
|
-
/**
|
|
29
|
-
* Sets the component's size.
|
|
30
|
-
*/
|
|
31
|
-
big?: boolean
|
|
32
|
-
/**
|
|
33
|
-
* Specifies the component variant.
|
|
34
|
-
*/
|
|
35
|
-
variant?: BadgeVariants
|
|
36
|
-
children: ReactNode
|
|
37
|
-
onClose?: () => void
|
|
38
|
-
/**
|
|
39
|
-
* Adds a Close Button to the component.
|
|
40
|
-
*/
|
|
41
|
-
actionable?: boolean
|
|
42
|
-
} & ActionableBadge
|
|
43
|
-
|
|
44
|
-
const Badge = ({
|
|
45
|
-
variant = 'neutral',
|
|
46
|
-
children,
|
|
47
|
-
onClose,
|
|
48
|
-
big = false,
|
|
49
|
-
actionable = false,
|
|
50
|
-
...otherProps
|
|
51
|
-
}: BadgeProps) => {
|
|
52
|
-
return (
|
|
53
|
-
<UIBadge
|
|
54
|
-
className={styles.fsBadge}
|
|
55
|
-
data-fs-badge={big ? 'big' : ''}
|
|
56
|
-
data-fs-badge-variant={variant}
|
|
57
|
-
data-fs-badge-actionable={actionable}
|
|
58
|
-
{...otherProps}
|
|
59
|
-
>
|
|
60
|
-
{actionable && (
|
|
61
|
-
<Button
|
|
62
|
-
aria-label="Remove"
|
|
63
|
-
data-fs-badge-button
|
|
64
|
-
onClick={onClose}
|
|
65
|
-
icon={<Icon name="X" width={18} height={18} weight="bold" />}
|
|
66
|
-
iconPosition="left"
|
|
67
|
-
/>
|
|
68
|
-
)}
|
|
69
|
-
<div data-fs-badge-wrapper>
|
|
70
|
-
<span>{children}</span>
|
|
71
|
-
</div>
|
|
72
|
-
</UIBadge>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default Badge
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
3
|
-
import { DiscountBadge } from '.'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
TokenTable,
|
|
7
|
-
TokenRow,
|
|
8
|
-
TokenDivider,
|
|
9
|
-
} from 'src/../.storybook/components'
|
|
10
|
-
|
|
11
|
-
<Meta title="Molecules/Badge/DiscountBadge" component={DiscountBadge} />
|
|
12
|
-
|
|
13
|
-
export const Template = (args) => <DiscountBadge {...args} />
|
|
14
|
-
|
|
15
|
-
<header>
|
|
16
|
-
|
|
17
|
-
# Discount Badge
|
|
18
|
-
|
|
19
|
-
A custom `Badge` that display product's discounts. You can see its usage on [ProductCard](?path=/docs/molecules-productcard--overview-default).
|
|
20
|
-
|
|
21
|
-
</header>
|
|
22
|
-
|
|
23
|
-
## Overview
|
|
24
|
-
|
|
25
|
-
The `DiscountBadge` component uses [Badge](?path=/docs/molecules-badge-default--overview-neutral) as base.
|
|
26
|
-
|
|
27
|
-
<Canvas>
|
|
28
|
-
<Story
|
|
29
|
-
name="overview-default"
|
|
30
|
-
args={{
|
|
31
|
-
big: false,
|
|
32
|
-
listPrice: 45,
|
|
33
|
-
spotPrice: 40,
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
{Template.bind({})}
|
|
37
|
-
</Story>
|
|
38
|
-
<Story
|
|
39
|
-
name="overview-discount-medium"
|
|
40
|
-
args={{
|
|
41
|
-
big: false,
|
|
42
|
-
listPrice: 65,
|
|
43
|
-
spotPrice: 40,
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
{Template.bind({})}
|
|
47
|
-
</Story>
|
|
48
|
-
<Story
|
|
49
|
-
name="overview-discount-high"
|
|
50
|
-
args={{
|
|
51
|
-
big: false,
|
|
52
|
-
listPrice: 80,
|
|
53
|
-
spotPrice: 40,
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
{Template.bind({})}
|
|
57
|
-
</Story>
|
|
58
|
-
</Canvas>
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Usage
|
|
63
|
-
|
|
64
|
-
`import DiscountBadge from '../components/ui/DiscountBadge'`
|
|
65
|
-
|
|
66
|
-
<Canvas>
|
|
67
|
-
<Story
|
|
68
|
-
name="default"
|
|
69
|
-
args={{
|
|
70
|
-
big: false,
|
|
71
|
-
listPrice: 45,
|
|
72
|
-
spotPrice: 40,
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
{Template.bind({})}
|
|
76
|
-
</Story>
|
|
77
|
-
</Canvas>
|
|
78
|
-
|
|
79
|
-
<ArgsTable story="default" />
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Variants
|
|
84
|
-
|
|
85
|
-
### Low Discount
|
|
86
|
-
|
|
87
|
-
<Canvas>
|
|
88
|
-
<Story
|
|
89
|
-
name="badge-discount-low"
|
|
90
|
-
args={{
|
|
91
|
-
big: false,
|
|
92
|
-
listPrice: 45,
|
|
93
|
-
spotPrice: 40,
|
|
94
|
-
}}
|
|
95
|
-
>
|
|
96
|
-
{Template.bind({})}
|
|
97
|
-
</Story>
|
|
98
|
-
</Canvas>
|
|
99
|
-
|
|
100
|
-
<TokenTable>
|
|
101
|
-
<TokenRow
|
|
102
|
-
token="--fs-badge-discount-low-bkg-color"
|
|
103
|
-
value="var(--fs-badge-success-bkg-color)"
|
|
104
|
-
globalValue="var(--fs-color-success-bkg)"
|
|
105
|
-
isColor
|
|
106
|
-
/>
|
|
107
|
-
<TokenRow
|
|
108
|
-
token="--fs-badge-discount-low-text-color"
|
|
109
|
-
value="var(--fs-badge-success-text-color)"
|
|
110
|
-
globalValue="var(--fs-color-text)"
|
|
111
|
-
isColor
|
|
112
|
-
/>
|
|
113
|
-
<TokenRow
|
|
114
|
-
token="--fs-badge-discount-low-border-color"
|
|
115
|
-
value="var(--fs-badge-success-border-color)"
|
|
116
|
-
globalValue="var(--fs-color-success-bkg)"
|
|
117
|
-
isColor
|
|
118
|
-
/>
|
|
119
|
-
</TokenTable>
|
|
120
|
-
|
|
121
|
-
### Medium Discount
|
|
122
|
-
|
|
123
|
-
<Canvas>
|
|
124
|
-
<Story
|
|
125
|
-
name="badge-discount-medium"
|
|
126
|
-
args={{
|
|
127
|
-
big: false,
|
|
128
|
-
listPrice: 65,
|
|
129
|
-
spotPrice: 40,
|
|
130
|
-
}}
|
|
131
|
-
>
|
|
132
|
-
{Template.bind({})}
|
|
133
|
-
</Story>
|
|
134
|
-
</Canvas>
|
|
135
|
-
|
|
136
|
-
<TokenTable>
|
|
137
|
-
<TokenRow
|
|
138
|
-
token="--fs-badge-discount-medium-bkg-color"
|
|
139
|
-
value="var(--fs-badge-warning-bkg-color)"
|
|
140
|
-
globalValue="var(--fs-color-warning-bkg)"
|
|
141
|
-
isColor
|
|
142
|
-
/>
|
|
143
|
-
<TokenRow
|
|
144
|
-
token="--fs-badge-discount-medium-text-color"
|
|
145
|
-
value="var(--fs-badge-warning-text-color)"
|
|
146
|
-
globalValue="var(--fs-color-warning-text)"
|
|
147
|
-
isColor
|
|
148
|
-
/>
|
|
149
|
-
<TokenRow
|
|
150
|
-
token="--fs-badge-discount-medium-border-color"
|
|
151
|
-
value="var(--fs-badge-warning-border-color)"
|
|
152
|
-
globalValue="var(--fs-color-warning-bkg)"
|
|
153
|
-
isColor
|
|
154
|
-
/>
|
|
155
|
-
</TokenTable>
|
|
156
|
-
|
|
157
|
-
### High Discount
|
|
158
|
-
|
|
159
|
-
<Canvas>
|
|
160
|
-
<Story
|
|
161
|
-
name="badge-discount-high"
|
|
162
|
-
args={{
|
|
163
|
-
big: false,
|
|
164
|
-
listPrice: 80,
|
|
165
|
-
spotPrice: 40,
|
|
166
|
-
}}
|
|
167
|
-
>
|
|
168
|
-
{Template.bind({})}
|
|
169
|
-
</Story>
|
|
170
|
-
</Canvas>
|
|
171
|
-
|
|
172
|
-
<TokenTable>
|
|
173
|
-
<TokenRow
|
|
174
|
-
token="--fs-badge-discount-high-bkg-color"
|
|
175
|
-
value="var(--fs-badge-danger-bkg-color)"
|
|
176
|
-
globalValue="var(--fs-color-danger-bkg)"
|
|
177
|
-
isColor
|
|
178
|
-
/>
|
|
179
|
-
<TokenRow
|
|
180
|
-
token="--fs-badge-discount-high-text-color"
|
|
181
|
-
value="var(--fs-badge-danger-text-color)"
|
|
182
|
-
globalValue="var(--fs-color-text)"
|
|
183
|
-
isColor
|
|
184
|
-
/>
|
|
185
|
-
<TokenRow
|
|
186
|
-
token="--fs-badge-discount-high-border-color"
|
|
187
|
-
value="var(--fs-badge-danger-border-color)"
|
|
188
|
-
globalValue="var(--fs-color-danger-bkg)"
|
|
189
|
-
isColor
|
|
190
|
-
/>
|
|
191
|
-
</TokenTable>
|