@faststore/core 0.3.5 → 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/.github/workflows/release.yml +1 -1
- package/.storybook/preview.js +0 -4
- package/CHANGELOG.md +9 -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
package/.storybook/preview.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import '!style-loader!css-loader!sass-loader!../src/styles/global/layout.scss'
|
|
2
|
-
import '!style-loader!css-loader!sass-loader!../src/styles/global/resets.scss'
|
|
3
1
|
import '!style-loader!css-loader!sass-loader!../src/styles/global/storybook-components.scss'
|
|
4
|
-
import '!style-loader!css-loader!sass-loader!../src/styles/global/tokens.scss'
|
|
5
|
-
import '!style-loader!css-loader!sass-loader!../src/styles/global/typography.scss'
|
|
6
2
|
import { initialize, mswDecorator } from 'msw-storybook-addon'
|
|
7
3
|
|
|
8
4
|
// Initialize MSW
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Conventional Changelog](https://github.com/conventional-changelog/conventional-changelog),
|
|
6
6
|
and this project adheres to [Calendar Versioning](https://calver.org/).
|
|
7
7
|
|
|
8
|
+
### [0.3.7](https://github.com/vtex-sites/nextjs.store/compare/0.3.6...0.3.7) (2022-12-15)
|
|
9
|
+
|
|
10
|
+
### [0.3.6](https://github.com/vtex-sites/nextjs.store/compare/0.3.5...0.3.6) (2022-12-15)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chores
|
|
14
|
+
|
|
15
|
+
* creating a branch intermediate to evergreen ([dd99e1d](https://github.com/vtex-sites/nextjs.store/commit/dd99e1d157c8f27b7d015edb6675676718e65c8d))
|
|
16
|
+
|
|
8
17
|
### [0.3.5](https://github.com/vtex-sites/nextjs.store/compare/0.3.4...0.3.5) (2022-11-30)
|
|
9
18
|
|
|
10
19
|
### [0.3.4](https://github.com/vtex-sites/nextjs.store/compare/0.3.3...0.3.4) (2022-11-23)
|
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ As of Sep, 2022, this starter is still far from covering most basic cases found
|
|
|
70
70
|
|
|
71
71
|
Your site is now running at `http://localhost:3000`!
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Open the `awesome.store` directory in your code editor of choice and edit `src/pages/index.tsx`. Save your changes and the browser will update in real-time!
|
|
74
74
|
|
|
75
75
|
## :technologist: Contributing
|
|
76
76
|
|
|
@@ -120,9 +120,9 @@ A quick look at the top-level files and directories you'll see in a NextJS proje
|
|
|
120
120
|
|
|
121
121
|
7. **`yarn.lock`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You won’t change this file directly).**
|
|
122
122
|
|
|
123
|
-
8.
|
|
123
|
+
8. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project.
|
|
124
124
|
|
|
125
|
-
9.
|
|
125
|
+
9. **`tsconfig.json`**: The configuration file for the typescript compiler. This will statically analyze your code for errors and bugs before releasing them into production
|
|
126
126
|
|
|
127
127
|
10. **`store.config.js`**: Configure your e-commerce platform, default sales channel etc.
|
|
128
128
|
|
|
@@ -219,20 +219,20 @@ touch src/components/ui/Button/button.scss
|
|
|
219
219
|
Now, on `button.scss`:
|
|
220
220
|
|
|
221
221
|
```css
|
|
222
|
-
[data-
|
|
222
|
+
[data-fs-button] {
|
|
223
223
|
display: inline-flex;
|
|
224
224
|
align-items: center;
|
|
225
225
|
justify-content: center;
|
|
226
226
|
}
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
This `data-
|
|
229
|
+
This `data-fs-button` is a CSS data attribute selector. To know which selectors are available, check [FastStore UI docs](https://faststoreui.netlify.app/).
|
|
230
230
|
|
|
231
231
|
Now, include the component's CSS into the Store's CSS. Open `src/styles/global/components.scss` and import this CSS with:
|
|
232
232
|
|
|
233
233
|
```scss
|
|
234
234
|
// ...
|
|
235
|
-
@import
|
|
235
|
+
@import 'src/components/ui/Button/button.scss';
|
|
236
236
|
// ...
|
|
237
237
|
```
|
|
238
238
|
|
|
@@ -256,11 +256,11 @@ export default Button
|
|
|
256
256
|
and then, on `button.scss`:
|
|
257
257
|
|
|
258
258
|
```css
|
|
259
|
-
[data-
|
|
259
|
+
[data-fs-button][data-button-variant='primary'] {
|
|
260
260
|
background: blue;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
[data-
|
|
263
|
+
[data-fs-button][data-button-variant='secondary'] {
|
|
264
264
|
background: pink;
|
|
265
265
|
}
|
|
266
266
|
```
|
|
@@ -274,11 +274,11 @@ function Button({ variant, ...props }: Props) {
|
|
|
274
274
|
```
|
|
275
275
|
|
|
276
276
|
```css
|
|
277
|
-
.primary[data-
|
|
277
|
+
.primary[data-fs-button] {
|
|
278
278
|
background: blue;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
.secondary[data-
|
|
281
|
+
.secondary[data-fs-button] {
|
|
282
282
|
background: pink;
|
|
283
283
|
}
|
|
284
284
|
```
|
|
@@ -286,6 +286,7 @@ function Button({ variant, ...props }: Props) {
|
|
|
286
286
|
Now we have a styled Button component that accepts different variants!! 🎉
|
|
287
287
|
|
|
288
288
|
### Managing SVG Icons
|
|
289
|
+
|
|
289
290
|
Icons help build web pages by illustrating concepts and improving website navigation. However, using icons can decrease the page's performance. One option to avoid the decrease of the page's performance is to use SVGs from a single SVG file, located in `/static/icons.svg`, and load them with the `ui/Icon` component.
|
|
290
291
|
|
|
291
292
|
In the following steps, learn how to add and use a new SVG icon and avoid decreasing page performance while using an icon.
|
|
@@ -295,6 +296,7 @@ In the following steps, learn how to add and use a new SVG icon and avoid decrea
|
|
|
295
296
|
> This is a recommendation while using icons on a web page. Evaluate if this fits in your project.
|
|
296
297
|
|
|
297
298
|
#### Adding an SVG icon
|
|
299
|
+
|
|
298
300
|
1. In the SVG file, change the `svg` tag to `symbol`.
|
|
299
301
|
2. Add an `id` to the symbol. Remember to use an unique `id` and do not replicate it.
|
|
300
302
|
3. Remove unnecessary HTML/SVG properties to allow you to style and decrease the final file size, such as `fill`, `stroke-width`, `width`, `height`, and `color`.
|
|
@@ -395,7 +397,7 @@ That's it! you have just regenerated all graphql queries/fragments for your appl
|
|
|
395
397
|
|
|
396
398
|
## CMS Integration
|
|
397
399
|
|
|
398
|
-
This store is integrated with [VTEX headless CMS](https://www.faststore.dev/tutorials/cms/0).
|
|
400
|
+
This store is integrated with [VTEX headless CMS](https://www.faststore.dev/tutorials/cms/0).
|
|
399
401
|
|
|
400
402
|
The page rendered with CMS is:
|
|
401
403
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"browserslist": "supports es6-module and not dead",
|
|
6
6
|
"scripts": {
|
|
@@ -30,38 +30,39 @@
|
|
|
30
30
|
"@envelop/graphql-jit": "^1.1.1",
|
|
31
31
|
"@envelop/parser-cache": "^2.2.0",
|
|
32
32
|
"@envelop/validation-cache": "^2.2.0",
|
|
33
|
-
"@faststore/api": "^
|
|
34
|
-
"@faststore/
|
|
35
|
-
"@faststore/
|
|
36
|
-
"@faststore/
|
|
33
|
+
"@faststore/api": "^2.0.3-alpha.0",
|
|
34
|
+
"@faststore/components": "^2.0.16-alpha.0",
|
|
35
|
+
"@faststore/graphql-utils": "^2.0.3-alpha.0",
|
|
36
|
+
"@faststore/sdk": "^2.0.3-alpha.0",
|
|
37
|
+
"@faststore/ui": "^2.0.16-alpha.0",
|
|
38
|
+
"@types/react": "^18.0.14",
|
|
37
39
|
"@vtex/client-cms": "^0.2.12",
|
|
40
|
+
"@vtex/tsconfig": "0.6.0",
|
|
41
|
+
"autoprefixer": "^10.4.0",
|
|
42
|
+
"css-loader": "^6.7.1",
|
|
43
|
+
"eslint": "^7.22.0",
|
|
44
|
+
"eslint-config-next": "12.1.5",
|
|
45
|
+
"eslint-config-vtex-react": "^9.0.0",
|
|
38
46
|
"graphql": "^15.0.0",
|
|
39
47
|
"include-media": "^1.4.10",
|
|
48
|
+
"msw": "^0.43.1",
|
|
40
49
|
"next": "^12.3.1",
|
|
41
50
|
"next-seo": "^5.4.0",
|
|
42
51
|
"nextjs-progressbar": "^0.0.14",
|
|
52
|
+
"postcss": "^8.4.4",
|
|
43
53
|
"react": "^18.2.0",
|
|
44
54
|
"react-dom": "^18.2.0",
|
|
45
55
|
"react-intersection-observer": "^8.32.5",
|
|
46
56
|
"sass": "^1.44.0",
|
|
47
|
-
"swr": "^1.3.0",
|
|
48
|
-
"@types/react": "^18.0.14",
|
|
49
|
-
"@vtex/tsconfig": "0.6.0",
|
|
50
|
-
"autoprefixer": "^10.4.0",
|
|
51
|
-
"css-loader": "^6.7.1",
|
|
52
|
-
"eslint": "^7.22.0",
|
|
53
|
-
"eslint-config-next": "12.1.5",
|
|
54
|
-
"eslint-config-vtex-react": "^9.0.0",
|
|
55
|
-
"msw": "^0.43.1",
|
|
56
|
-
"postcss": "^8.4.4",
|
|
57
57
|
"sass-loader": "^12.6.0",
|
|
58
58
|
"style-loader": "^3.3.1",
|
|
59
|
+
"swr": "^1.3.0",
|
|
59
60
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
60
61
|
"typescript": "4.7.3"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
64
|
"@cypress/code-coverage": "^3.9.10",
|
|
64
|
-
"@faststore/lighthouse": "^1.
|
|
65
|
+
"@faststore/lighthouse": "^1.12.32",
|
|
65
66
|
"@graphql-codegen/cli": "^2.6.2",
|
|
66
67
|
"@graphql-codegen/typescript": "^2.5.1",
|
|
67
68
|
"@graphql-codegen/typescript-operations": "^2.4.2",
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
CartItemPrices as UICartItemPrices,
|
|
8
8
|
CartItemContent as UICartItemContent,
|
|
9
9
|
CartItemImage as UICartItemImage,
|
|
10
|
+
Button as UIButton,
|
|
10
11
|
} from '@faststore/ui'
|
|
11
12
|
import { useCallback, useMemo } from 'react'
|
|
12
13
|
import type {
|
|
@@ -15,7 +16,6 @@ import type {
|
|
|
15
16
|
RemoveFromCartEvent,
|
|
16
17
|
} from '@faststore/sdk'
|
|
17
18
|
|
|
18
|
-
import Button from 'src/components/ui/Button'
|
|
19
19
|
import Icon from 'src/components/ui/Icon'
|
|
20
20
|
import { Image } from 'src/components/ui/Image'
|
|
21
21
|
import Price from 'src/components/ui/Price'
|
|
@@ -136,14 +136,14 @@ function CartItem({ item, gift = false }: Props) {
|
|
|
136
136
|
|
|
137
137
|
{!gift && (
|
|
138
138
|
<UICartItemActions>
|
|
139
|
-
<
|
|
140
|
-
variant="tertiary"
|
|
139
|
+
<UIButton
|
|
141
140
|
icon={<Icon name="XCircle" width={18} height={18} />}
|
|
142
141
|
iconPosition="left"
|
|
142
|
+
variant="tertiary"
|
|
143
143
|
{...btnProps}
|
|
144
144
|
>
|
|
145
145
|
Remove
|
|
146
|
-
</
|
|
146
|
+
</UIButton>
|
|
147
147
|
<QuantitySelector
|
|
148
148
|
min={1}
|
|
149
149
|
initial={item.quantity}
|
|
@@ -7,7 +7,7 @@ import CartToggle from 'src/components/cart/CartToggle'
|
|
|
7
7
|
import CartSidebar from '.'
|
|
8
8
|
|
|
9
9
|
import { cartItem } from 'src/../.storybook/mocks/cart-sidebar'
|
|
10
|
-
import {
|
|
10
|
+
import { BuyButton } from '@faststore/ui'
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
TokenTable,
|
|
@@ -23,12 +23,12 @@ export const Template = () => {
|
|
|
23
23
|
return (
|
|
24
24
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
25
25
|
<CartToggle />
|
|
26
|
-
<
|
|
26
|
+
<BuyButton
|
|
27
27
|
style={{ marginLeft: '12px' }}
|
|
28
28
|
onClick={() => addItem(cartItem)}
|
|
29
29
|
>
|
|
30
30
|
Add item to Cart
|
|
31
|
-
</
|
|
31
|
+
</BuyButton>
|
|
32
32
|
{displayCart && <CartSidebar />}
|
|
33
33
|
</div>
|
|
34
34
|
)
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { sendAnalyticsEvent } from '@faststore/sdk'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
List as UIList,
|
|
4
|
+
IconButton as UIIconButton,
|
|
5
|
+
Button as UIButton,
|
|
6
|
+
Badge as UIBadge,
|
|
7
|
+
} from '@faststore/ui'
|
|
3
8
|
import { useEffect } from 'react'
|
|
4
9
|
import type { ViewCartEvent, CurrencyCode } from '@faststore/sdk'
|
|
5
10
|
|
|
6
11
|
import Alert from 'src/components/ui/Alert'
|
|
7
|
-
import { Badge } from 'src/components/ui/Badge'
|
|
8
|
-
import Button from 'src/components/ui/Button'
|
|
9
12
|
import Icon from 'src/components/ui/Icon'
|
|
10
13
|
import SlideOver from 'src/components/ui/SlideOver'
|
|
11
14
|
import { useCart } from 'src/sdk/cart'
|
|
@@ -68,9 +71,9 @@ function CartSidebar() {
|
|
|
68
71
|
<p data-fs-cart-sidebar-title-text className="text__lead">
|
|
69
72
|
Your Cart
|
|
70
73
|
</p>
|
|
71
|
-
<
|
|
74
|
+
<UIBadge variant="info">{totalItems}</UIBadge>
|
|
72
75
|
</div>
|
|
73
|
-
<
|
|
76
|
+
<UIIconButton
|
|
74
77
|
data-fs-cart-sidebar-close-button
|
|
75
78
|
data-testid="cart-sidebar-button-close"
|
|
76
79
|
aria-label="Close Cart"
|
|
@@ -86,26 +89,26 @@ function CartSidebar() {
|
|
|
86
89
|
<EmptyCart onDismiss={fadeOut} />
|
|
87
90
|
) : (
|
|
88
91
|
<>
|
|
89
|
-
<
|
|
92
|
+
<UIList data-fs-cart-sidebar-list>
|
|
90
93
|
{items.map((item) => (
|
|
91
94
|
<li key={item.id}>
|
|
92
95
|
<CartItem item={item} />
|
|
93
96
|
</li>
|
|
94
97
|
))}
|
|
95
|
-
</
|
|
98
|
+
</UIList>
|
|
96
99
|
|
|
97
100
|
{gifts.length > 0 && (
|
|
98
101
|
<>
|
|
99
102
|
<Alert icon={<Icon name="Gift" width={24} height={24} />}>
|
|
100
103
|
Gifts
|
|
101
104
|
</Alert>
|
|
102
|
-
<
|
|
105
|
+
<UIList data-fs-cart-sidebar-list>
|
|
103
106
|
{gifts.map((item) => (
|
|
104
107
|
<li key={item.id}>
|
|
105
108
|
<CartItem gift item={item} />
|
|
106
109
|
</li>
|
|
107
110
|
))}
|
|
108
|
-
</
|
|
111
|
+
</UIList>
|
|
109
112
|
</>
|
|
110
113
|
)}
|
|
111
114
|
|
|
@@ -115,7 +118,7 @@ function CartSidebar() {
|
|
|
115
118
|
total={total}
|
|
116
119
|
numberOfItems={totalItems}
|
|
117
120
|
checkoutButton={
|
|
118
|
-
<
|
|
121
|
+
<UIButton
|
|
119
122
|
data-fs-cart-sidebar-checkout-button
|
|
120
123
|
variant="primary"
|
|
121
124
|
icon={
|
|
@@ -127,7 +130,7 @@ function CartSidebar() {
|
|
|
127
130
|
{...btnProps}
|
|
128
131
|
>
|
|
129
132
|
{isValidating ? 'Loading...' : 'Checkout'}
|
|
130
|
-
</
|
|
133
|
+
</UIButton>
|
|
131
134
|
}
|
|
132
135
|
/>
|
|
133
136
|
</footer>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IconButton as UIIconButton, Badge as UIBadge } from '@faststore/ui'
|
|
2
|
+
|
|
2
3
|
import Icon from 'src/components/ui/Icon'
|
|
3
4
|
import { useCartToggleButton } from 'src/sdk/cart/useCartToggleButton'
|
|
4
5
|
|
|
@@ -7,13 +8,14 @@ function CartToggle() {
|
|
|
7
8
|
const totalItems = btnProps['data-items']
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
|
-
<
|
|
11
|
+
<UIIconButton
|
|
11
12
|
data-fs-cart-toggle
|
|
12
|
-
counter={totalItems}
|
|
13
13
|
aria-label={`Cart with ${totalItems} items`}
|
|
14
14
|
icon={<Icon name="ShoppingCart" width={32} height={32} />}
|
|
15
15
|
{...btnProps}
|
|
16
|
-
|
|
16
|
+
>
|
|
17
|
+
<UIBadge counter>{totalItems}</UIBadge>
|
|
18
|
+
</UIIconButton>
|
|
17
19
|
)
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import Button from '
|
|
1
|
+
import { Button as UIButton } from '@faststore/ui'
|
|
2
|
+
|
|
2
3
|
import EmptyState from 'src/components/ui/EmptyState'
|
|
3
4
|
import Icon from 'src/components/ui/Icon'
|
|
4
5
|
|
|
@@ -16,9 +17,9 @@ function EmptyCart({ onDismiss }: Props) {
|
|
|
16
17
|
<Icon name="ShoppingCart" width={56} height={56} weight="thin" />
|
|
17
18
|
<p>Your Cart is empty</p>
|
|
18
19
|
</header>
|
|
19
|
-
<
|
|
20
|
+
<UIButton onClick={onDismiss} variant="secondary">
|
|
20
21
|
Start Shopping
|
|
21
|
-
</
|
|
22
|
+
</UIButton>
|
|
22
23
|
</EmptyState>
|
|
23
24
|
)
|
|
24
25
|
}
|
|
@@ -49,10 +49,11 @@ export function Footer({
|
|
|
49
49
|
{sectionSocial && (
|
|
50
50
|
<section data-fs-footer-social>
|
|
51
51
|
<p data-fs-footer-title>Follow us</p>
|
|
52
|
-
<UIList
|
|
52
|
+
<UIList>
|
|
53
53
|
<li>
|
|
54
54
|
<Link
|
|
55
|
-
variant="
|
|
55
|
+
variant="display"
|
|
56
|
+
size="small"
|
|
56
57
|
href="https://www.facebook.com/"
|
|
57
58
|
title="Facebook"
|
|
58
59
|
target="_blank"
|
|
@@ -63,7 +64,8 @@ export function Footer({
|
|
|
63
64
|
</li>
|
|
64
65
|
<li>
|
|
65
66
|
<Link
|
|
66
|
-
variant="
|
|
67
|
+
variant="display"
|
|
68
|
+
size="small"
|
|
67
69
|
href="https://www.instagram.com/"
|
|
68
70
|
title="Instagram"
|
|
69
71
|
target="_blank"
|
|
@@ -74,7 +76,8 @@ export function Footer({
|
|
|
74
76
|
</li>
|
|
75
77
|
<li>
|
|
76
78
|
<Link
|
|
77
|
-
variant="
|
|
79
|
+
variant="display"
|
|
80
|
+
size="small"
|
|
78
81
|
href="https://www.pinterest.com/"
|
|
79
82
|
title="Pinterest"
|
|
80
83
|
target="_blank"
|
|
@@ -85,7 +88,8 @@ export function Footer({
|
|
|
85
88
|
</li>
|
|
86
89
|
<li>
|
|
87
90
|
<Link
|
|
88
|
-
variant="
|
|
91
|
+
variant="display"
|
|
92
|
+
size="small"
|
|
89
93
|
href="https://twitter.com/"
|
|
90
94
|
title="Twitter"
|
|
91
95
|
target="_blank"
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Suspense, useRef, useState } from 'react'
|
|
2
|
+
import { IconButton as UIIconButton } from '@faststore/ui'
|
|
2
3
|
|
|
3
4
|
import CartToggle from 'src/components/cart/CartToggle'
|
|
4
5
|
import SearchInput from 'src/components/search/SearchInput'
|
|
5
6
|
import type { SearchInputRef } from 'src/components/search/SearchInput'
|
|
6
|
-
import
|
|
7
|
-
ButtonSignIn,
|
|
8
|
-
ButtonSignInFallback,
|
|
9
|
-
} from 'src/components/ui/Button'
|
|
7
|
+
import { ButtonSignIn, ButtonSignInFallback } from 'src/components/ui/Button'
|
|
10
8
|
import Icon from 'src/components/ui/Icon'
|
|
11
9
|
import Link from 'src/components/ui/Link'
|
|
12
10
|
import Logo from 'src/components/ui/Logo'
|
|
@@ -39,7 +37,7 @@ function Navbar() {
|
|
|
39
37
|
<div className="layout__content" data-fs-navbar-row>
|
|
40
38
|
{!searchExpanded && (
|
|
41
39
|
<>
|
|
42
|
-
<
|
|
40
|
+
<UIIconButton
|
|
43
41
|
data-fs-navbar-button-menu
|
|
44
42
|
aria-label="Open Menu"
|
|
45
43
|
icon={<Icon name="List" width={32} height={32} />}
|
|
@@ -61,7 +59,7 @@ function Navbar() {
|
|
|
61
59
|
data-fs-navbar-search-expanded={searchExpanded}
|
|
62
60
|
>
|
|
63
61
|
{searchExpanded && (
|
|
64
|
-
<
|
|
62
|
+
<UIIconButton
|
|
65
63
|
data-fs-button-collapse
|
|
66
64
|
aria-label="Collapse search bar"
|
|
67
65
|
icon={<Icon name="CaretLeft" width={32} height={32} />}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Suspense } from 'react'
|
|
2
|
+
import { IconButton as UIIconButton } from '@faststore/ui'
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
-
ButtonSignIn,
|
|
5
|
-
ButtonSignInFallback,
|
|
6
|
-
} from 'src/components/ui/Button'
|
|
4
|
+
import { ButtonSignIn, ButtonSignInFallback } from 'src/components/ui/Button'
|
|
7
5
|
import Icon from 'src/components/ui/Icon'
|
|
8
6
|
import Link from 'src/components/ui/Link'
|
|
9
7
|
import Logo from 'src/components/ui/Logo'
|
|
@@ -40,7 +38,7 @@ function NavbarSlider() {
|
|
|
40
38
|
<Logo />
|
|
41
39
|
</Link>
|
|
42
40
|
|
|
43
|
-
<
|
|
41
|
+
<UIIconButton
|
|
44
42
|
data-fs-navbar-slider-button
|
|
45
43
|
aria-label="Close Menu"
|
|
46
44
|
icon={<Icon name="X" width={32} height={32} />}
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
[data-fs-button
|
|
180
|
+
[data-fs-icon-button="true"] {
|
|
181
181
|
margin-right: var(--fs-navbar-search-expanded-button-icon-margin-right);
|
|
182
182
|
transition: margin var(--fs-navbar-transition-timing) var(--fs-navbar-transition-function);
|
|
183
183
|
}
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
OutOfStock as UIOutOfStock,
|
|
3
3
|
OutOfStockTitle as UIOutOfStockTitle,
|
|
4
4
|
OutOfStockMessage as UIOutOfStockMessage,
|
|
5
|
+
Button as UIButton,
|
|
6
|
+
InputField as UIInputField,
|
|
5
7
|
} from '@faststore/ui'
|
|
6
8
|
import { useState } from 'react'
|
|
7
9
|
import type { ReactElement, FormEvent } from 'react'
|
|
8
10
|
|
|
9
|
-
import Button from 'src/components/ui/Button'
|
|
10
11
|
import Icon from 'src/components/ui/Icon'
|
|
11
|
-
import InputText from 'src/components/ui/InputText'
|
|
12
12
|
import styles from 'src/components/product/OutOfStock/out-of-stock.module.scss'
|
|
13
13
|
import { useSession } from 'src/sdk/session'
|
|
14
14
|
|
|
@@ -106,7 +106,7 @@ function OutOfStock(props: OutOfStockProps) {
|
|
|
106
106
|
<UIOutOfStockMessage data-fs-out-of-stock-message>
|
|
107
107
|
{notificationMsgIcon} {notificationMsg}
|
|
108
108
|
</UIOutOfStockMessage>
|
|
109
|
-
<
|
|
109
|
+
<UIInputField
|
|
110
110
|
id="out-of-stock-email"
|
|
111
111
|
value={email}
|
|
112
112
|
label="Email"
|
|
@@ -117,7 +117,7 @@ function OutOfStock(props: OutOfStockProps) {
|
|
|
117
117
|
setEmail(e.target.value)
|
|
118
118
|
}}
|
|
119
119
|
/>
|
|
120
|
-
<
|
|
120
|
+
<UIButton
|
|
121
121
|
data-fs-out-of-stock-button
|
|
122
122
|
type="submit"
|
|
123
123
|
disabled={disabled}
|
|
@@ -126,7 +126,7 @@ function OutOfStock(props: OutOfStockProps) {
|
|
|
126
126
|
iconPosition="left"
|
|
127
127
|
>
|
|
128
128
|
{buttonText}
|
|
129
|
-
</
|
|
129
|
+
</UIButton>
|
|
130
130
|
</UIOutOfStock>
|
|
131
131
|
)
|
|
132
132
|
}
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
control: { type: 'radio' },
|
|
26
26
|
table: { defaultValue: '1' },
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
BuyButton: {
|
|
29
29
|
control: 'boolean',
|
|
30
30
|
table: { defaultValue: false },
|
|
31
31
|
},
|
|
@@ -63,8 +63,8 @@ export const product = {
|
|
|
63
63
|
},
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export const Template = ({
|
|
67
|
-
const button =
|
|
66
|
+
export const Template = ({ BuyButton, ...args }) => {
|
|
67
|
+
const button = BuyButton ? (
|
|
68
68
|
<Button
|
|
69
69
|
variant="primary"
|
|
70
70
|
data-fs-button-size="small"
|
|
@@ -76,13 +76,13 @@ export const Template = ({ ButtonBuy, ...args }) => {
|
|
|
76
76
|
) : null
|
|
77
77
|
return (
|
|
78
78
|
<div style={{ width: 300 }}>
|
|
79
|
-
<ProductCard
|
|
79
|
+
<ProductCard BuyButton={button} {...args} />
|
|
80
80
|
</div>
|
|
81
81
|
)
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export const TemplateWide = ({
|
|
85
|
-
const button =
|
|
84
|
+
export const TemplateWide = ({ BuyButton, ...args }) => {
|
|
85
|
+
const button = BuyButton ? (
|
|
86
86
|
<Button
|
|
87
87
|
variant="primary"
|
|
88
88
|
data-fs-button-size="small"
|
|
@@ -94,7 +94,7 @@ export const TemplateWide = ({ ButtonBuy, ...args }) => {
|
|
|
94
94
|
) : null
|
|
95
95
|
return (
|
|
96
96
|
<div style={{ width: 400 }}>
|
|
97
|
-
<ProductCard
|
|
97
|
+
<ProductCard BuyButton={button} {...args} />
|
|
98
98
|
</div>
|
|
99
99
|
)
|
|
100
100
|
}
|
|
@@ -120,7 +120,7 @@ The `ProductCard` component uses [FastStore UI ProductCard](https://www.faststor
|
|
|
120
120
|
variant: 'default',
|
|
121
121
|
bordered: false,
|
|
122
122
|
aspectRatio: 1,
|
|
123
|
-
|
|
123
|
+
BuyButton: false,
|
|
124
124
|
}}
|
|
125
125
|
>
|
|
126
126
|
{Template.bind({})}
|
|
@@ -133,7 +133,7 @@ The `ProductCard` component uses [FastStore UI ProductCard](https://www.faststor
|
|
|
133
133
|
variant: 'default',
|
|
134
134
|
bordered: true,
|
|
135
135
|
aspectRatio: 1,
|
|
136
|
-
|
|
136
|
+
BuyButton: false,
|
|
137
137
|
}}
|
|
138
138
|
>
|
|
139
139
|
{Template.bind({})}
|
|
@@ -146,7 +146,7 @@ The `ProductCard` component uses [FastStore UI ProductCard](https://www.faststor
|
|
|
146
146
|
variant: 'wide',
|
|
147
147
|
bordered: false,
|
|
148
148
|
aspectRatio: 1.5,
|
|
149
|
-
|
|
149
|
+
BuyButton: false,
|
|
150
150
|
}}
|
|
151
151
|
>
|
|
152
152
|
{TemplateWide.bind({})}
|
|
@@ -166,7 +166,7 @@ The `ProductCard` component uses [FastStore UI ProductCard](https://www.faststor
|
|
|
166
166
|
variant: 'default',
|
|
167
167
|
bordered: false,
|
|
168
168
|
aspectRatio: 1,
|
|
169
|
-
|
|
169
|
+
BuyButton: false,
|
|
170
170
|
}}
|
|
171
171
|
>
|
|
172
172
|
{Template.bind({})}
|
|
@@ -342,7 +342,7 @@ The `ProductCard` component uses [FastStore UI ProductCard](https://www.faststor
|
|
|
342
342
|
variant: 'default',
|
|
343
343
|
bordered: false,
|
|
344
344
|
aspectRatio: 1,
|
|
345
|
-
|
|
345
|
+
BuyButton: false,
|
|
346
346
|
}}
|
|
347
347
|
>
|
|
348
348
|
{Template.bind({})}
|
|
@@ -360,7 +360,7 @@ The `ProductCard` component uses [FastStore UI ProductCard](https://www.faststor
|
|
|
360
360
|
variant: 'default',
|
|
361
361
|
bordered: true,
|
|
362
362
|
aspectRatio: 1,
|
|
363
|
-
|
|
363
|
+
BuyButton: false,
|
|
364
364
|
}}
|
|
365
365
|
>
|
|
366
366
|
{Template.bind({})}
|
|
@@ -390,7 +390,7 @@ The `ProductCard` component uses [FastStore UI ProductCard](https://www.faststor
|
|
|
390
390
|
variant: 'wide',
|
|
391
391
|
bordered: false,
|
|
392
392
|
aspectRatio: 1.5,
|
|
393
|
-
|
|
393
|
+
BuyButton: false,
|
|
394
394
|
}}
|
|
395
395
|
>
|
|
396
396
|
{TemplateWide.bind({})}
|