@faststore/core 0.3.17 → 2.0.65-alpha.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/.storybook/storybook.css +1 -0
- package/.turbo/turbo-build.log +50 -0
- package/.turbo/turbo-lint.log +2 -0
- package/@generated/graphql/index.ts +27 -3
- package/@generated/graphql/persisted.json +1 -1
- package/CHANGELOG.md +116 -180
- package/README.md +2 -2
- package/cypress/integration/analytics.test.js +3 -3
- package/cypress/integration/cart.test.js +2 -2
- package/cypress/integration/plp.test.js +8 -8
- package/package.json +8 -9
- package/src/Layout.tsx +1 -1
- package/src/components/cart/CartItem/CartItem.tsx +30 -71
- package/src/components/cart/CartSidebar/CartSidebar.stories.mdx +1 -1
- package/src/components/cart/CartSidebar/CartSidebar.tsx +9 -12
- package/src/components/common/Footer/Footer.tsx +5 -38
- package/src/components/common/Footer/FooterFlags.tsx +23 -0
- package/src/components/common/Footer/footer.module.scss +2 -28
- package/src/components/common/Footer/index.ts +1 -0
- package/src/components/common/Navbar/NavLinks.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.stories.mdx +1 -1
- package/src/components/common/Navbar/Navbar.tsx +1 -1
- package/src/components/common/Navbar/NavbarSlider.stories.mdx +1 -1
- package/src/components/common/Navbar/NavbarSlider.tsx +2 -2
- package/src/components/common/Toast/Toast.tsx +1 -1
- package/src/components/product/ProductCard/ProductCard.tsx +44 -59
- package/src/components/product/ProductGrid/ProductGrid.tsx +7 -1
- package/src/components/regionalization/Regionalization.stories.mdx +24 -6
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.stories.mdx +1 -1
- package/src/components/regionalization/RegionalizationBar/RegionalizationBar.tsx +1 -1
- package/src/components/regionalization/RegionalizationButton/RegionalizationButton.tsx +1 -1
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.stories.mdx +17 -4
- package/src/components/regionalization/RegionalizationModal/RegionalizationModal.tsx +4 -5
- package/src/components/regionalization/RegionalizationModal/RegionalizationModalContent.tsx +19 -26
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-body.module.scss +25 -0
- package/src/components/search/Filter/Facets.stories.mdx +1 -1
- package/src/components/search/Filter/Filter.stories.mdx +1 -1
- package/src/components/search/Filter/Filter.tsx +1 -1
- package/src/components/search/Filter/FilterSlider.stories.mdx +1 -1
- package/src/components/search/Filter/FilterSlider.tsx +2 -2
- package/src/components/sections/Newsletter/Newsletter.stories.mdx +1 -1
- package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
- package/src/components/sections/ProductDetails/ProductDetails.tsx +2 -2
- package/src/components/sections/ProductGallery/ProductGallery.tsx +18 -18
- package/src/components/sections/ProductShelf/ProductShelf.tsx +10 -2
- package/src/components/sections/ProductTiles/ProductTiles.tsx +2 -2
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.stories.mdx +1 -1
- package/src/components/skeletons/FilterSkeleton/FilterSkeleton.tsx +20 -8
- package/src/components/skeletons/FilterSkeleton/filter-skeleton.module.scss +2 -2
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.stories.mdx +6 -69
- package/src/components/skeletons/ProductCardSkeleton/ProductCardSkeleton.tsx +36 -9
- package/src/components/skeletons/ProductCardSkeleton/product-card-skeleton.module.scss +16 -55
- package/src/components/skeletons/ProductGridSkeleton/ProductGridSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductShelfSkeleton/ProductShelfSkeleton.tsx +3 -1
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/ProductTileSkeleton.tsx +18 -17
- package/src/components/skeletons/ProductTilesSkeleton/ProductTileSkeleton/product-tile-skeleton.module.scss +37 -174
- package/src/components/skeletons/ProductTilesSkeleton/ProductTilesSkeleton.tsx +18 -3
- package/src/components/ui/Gift/Gift.tsx +12 -15
- package/src/components/ui/SlideOver/SlideOver.stories.mdx +2 -2
- package/src/components/ui/SlideOver/SlideOver.tsx +1 -0
- package/src/components/ui/Tiles/Tiles.stories.mdx +1 -3
- package/src/components/ui/Tiles/tiles.module.scss +11 -13
- package/src/components/ui/Toast/Toast.stories.mdx +1 -1
- package/src/components/ui/Toast/Toast.tsx +1 -1
- package/src/pages/_app.tsx +1 -1
- package/src/sdk/cart/index.ts +5 -0
- package/src/sdk/cart/useBuyButton.ts +1 -1
- package/src/sdk/cart/useCartToggleButton.ts +1 -1
- package/src/styles/vendors/include-media.scss +1 -1
- package/tsconfig.json +3 -5
- package/.eslintrc.json +0 -3
- package/.github/CODEOWNERS +0 -2
- package/.github/workflows/release.yml +0 -42
- package/.release-it.json +0 -32
- package/src/components/cart/CartItem/cart-item.module.scss +0 -68
- package/src/components/product/ProductCard/product-card.module.scss +0 -254
- package/src/components/regionalization/RegionalizationModal/regionalization-modal-content.module.scss +0 -79
- package/src/components/skeletons/Shimmer/Shimmer.tsx +0 -11
- package/src/components/skeletons/Shimmer/index.ts +0 -1
- package/src/components/skeletons/Shimmer/shimmer.module.scss +0 -43
- package/src/components/skeletons/Skeleton/Skeleton.tsx +0 -49
- package/src/components/skeletons/Skeleton/index.ts +0 -1
- package/src/components/skeletons/Skeleton/skeleton.module.scss +0 -77
- package/src/components/skeletons/Skeletons.stories.mdx +0 -177
- package/src/components/ui/Modal/Modal.stories.mdx +0 -144
- package/src/components/ui/Modal/Modal.tsx +0 -43
- package/src/components/ui/Modal/index.ts +0 -1
- package/src/components/ui/Modal/modal.module.scss +0 -46
- package/src/components/ui/ProductTitle/ProductTitle.stories.mdx +0 -105
- package/src/components/ui/ProductTitle/ProductTitle.tsx +0 -11
- package/src/components/ui/ProductTitle/index.ts +0 -1
- package/src/components/ui/ProductTitle/product-title.module.scss +0 -48
- package/src/sdk/ui/Provider.tsx +0 -151
- package/src/sdk/ui/useFadeEffect.ts +0 -21
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProductCard as UIProductCard,
|
|
3
|
-
ProductCardActions as UIProductCardActions,
|
|
4
3
|
ProductCardContent as UIProductCardContent,
|
|
5
4
|
ProductCardImage as UIProductCardImage,
|
|
6
|
-
Badge as UIBadge,
|
|
7
|
-
DiscountBadge as UIDiscountBadge,
|
|
8
5
|
} from '@faststore/ui'
|
|
9
6
|
import { gql } from '@faststore/graphql-utils'
|
|
10
7
|
import { memo } from 'react'
|
|
11
|
-
import type { ReactNode } from 'react'
|
|
12
8
|
|
|
13
|
-
import Link from 'src/components/ui/Link'
|
|
14
9
|
import { Image } from 'src/components/ui/Image'
|
|
15
|
-
import Price from 'src/components/ui/Price'
|
|
16
10
|
import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
|
|
17
11
|
import { useProductLink } from 'src/sdk/product/useProductLink'
|
|
18
12
|
import type { ProductSummary_ProductFragment } from '@generated/graphql'
|
|
19
|
-
import
|
|
13
|
+
import NextLink from 'next/link'
|
|
20
14
|
|
|
21
15
|
type Variant = 'wide' | 'default'
|
|
22
16
|
|
|
@@ -36,18 +30,33 @@ export interface ProductCardProps {
|
|
|
36
30
|
*/
|
|
37
31
|
aspectRatio?: number
|
|
38
32
|
/**
|
|
39
|
-
*
|
|
33
|
+
* Specifies Rating Value of the product.
|
|
40
34
|
*/
|
|
41
|
-
|
|
35
|
+
ratingValue?: number
|
|
36
|
+
/**
|
|
37
|
+
* Callback function when button is clicked.
|
|
38
|
+
*/
|
|
39
|
+
onButtonClick?: () => void
|
|
40
|
+
/**
|
|
41
|
+
* Specifies the button's label.
|
|
42
|
+
*/
|
|
43
|
+
buttonLabel?: string
|
|
44
|
+
/**
|
|
45
|
+
* Enables a DiscountBadge to the component.
|
|
46
|
+
*/
|
|
47
|
+
showDiscountBadge?: boolean
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
function ProductCard({
|
|
45
51
|
product,
|
|
46
52
|
index,
|
|
47
|
-
variant = 'default',
|
|
48
53
|
bordered = false,
|
|
54
|
+
variant = 'default',
|
|
49
55
|
aspectRatio = 1,
|
|
50
|
-
|
|
56
|
+
ratingValue,
|
|
57
|
+
buttonLabel = 'Add',
|
|
58
|
+
onButtonClick,
|
|
59
|
+
showDiscountBadge = true,
|
|
51
60
|
...otherProps
|
|
52
61
|
}: ProductCardProps) {
|
|
53
62
|
const {
|
|
@@ -60,20 +69,24 @@ function ProductCard({
|
|
|
60
69
|
},
|
|
61
70
|
} = product
|
|
62
71
|
|
|
63
|
-
const linkProps =
|
|
72
|
+
const linkProps = {
|
|
73
|
+
...useProductLink({ product, selectedOffer: 0, index }),
|
|
74
|
+
as: NextLink,
|
|
75
|
+
passHref: true,
|
|
76
|
+
legacyBehavior: false,
|
|
77
|
+
}
|
|
78
|
+
|
|
64
79
|
const outOfStock = availability !== 'https://schema.org/InStock'
|
|
65
80
|
|
|
66
81
|
return (
|
|
67
82
|
<UIProductCard
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
data-fs-product-card-actionable={!!BuyButton}
|
|
83
|
+
outOfStock={outOfStock}
|
|
84
|
+
bordered={bordered}
|
|
85
|
+
variant={variant}
|
|
72
86
|
data-fs-product-card-sku={sku}
|
|
73
|
-
className={styles.fsProductCard}
|
|
74
87
|
{...otherProps}
|
|
75
88
|
>
|
|
76
|
-
<UIProductCardImage
|
|
89
|
+
<UIProductCardImage aspectRatio={aspectRatio}>
|
|
77
90
|
<Image
|
|
78
91
|
src={img.url}
|
|
79
92
|
alt={img.alternateName}
|
|
@@ -83,47 +96,19 @@ function ProductCard({
|
|
|
83
96
|
loading="lazy"
|
|
84
97
|
/>
|
|
85
98
|
</UIProductCardImage>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
data-value={listPrice}
|
|
100
|
-
variant="listing"
|
|
101
|
-
classes="text__legend"
|
|
102
|
-
SRText="Original price:"
|
|
103
|
-
/>
|
|
104
|
-
<Price
|
|
105
|
-
value={spotPrice}
|
|
106
|
-
formatter={useFormattedPrice}
|
|
107
|
-
testId="price"
|
|
108
|
-
data-value={spotPrice}
|
|
109
|
-
variant="spot"
|
|
110
|
-
classes="text__body"
|
|
111
|
-
SRText="Sale Price:"
|
|
112
|
-
/>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
{outOfStock ? (
|
|
117
|
-
<UIBadge>Out of stock</UIBadge>
|
|
118
|
-
) : (
|
|
119
|
-
<UIDiscountBadge listPrice={listPrice} spotPrice={spotPrice} />
|
|
120
|
-
)}
|
|
121
|
-
{!!BuyButton && (
|
|
122
|
-
<UIProductCardActions data-fs-product-card-actions>
|
|
123
|
-
{BuyButton}
|
|
124
|
-
</UIProductCardActions>
|
|
125
|
-
)}
|
|
126
|
-
</UIProductCardContent>
|
|
99
|
+
<UIProductCardContent
|
|
100
|
+
title={name}
|
|
101
|
+
price={{
|
|
102
|
+
value: spotPrice,
|
|
103
|
+
listPrice: listPrice,
|
|
104
|
+
formatter: useFormattedPrice,
|
|
105
|
+
}}
|
|
106
|
+
ratingValue={ratingValue}
|
|
107
|
+
outOfStock={outOfStock}
|
|
108
|
+
onButtonClick={onButtonClick}
|
|
109
|
+
linkProps={linkProps}
|
|
110
|
+
showDiscountBadge={showDiscountBadge}
|
|
111
|
+
/>
|
|
127
112
|
</UIProductCard>
|
|
128
113
|
)
|
|
129
114
|
}
|
|
@@ -17,8 +17,13 @@ interface Props {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function ProductGrid({ products, page, pageSize }: Props) {
|
|
20
|
+
const aspectRatio = 1
|
|
21
|
+
|
|
20
22
|
return (
|
|
21
|
-
<ProductGridSkeleton
|
|
23
|
+
<ProductGridSkeleton
|
|
24
|
+
aspectRatio={aspectRatio}
|
|
25
|
+
loading={products.length === 0}
|
|
26
|
+
>
|
|
22
27
|
<ul data-fs-product-grid className={styles.fsProductGrid}>
|
|
23
28
|
{products.map(({ node: product }, idx) => (
|
|
24
29
|
<li key={`${product.id}`}>
|
|
@@ -26,6 +31,7 @@ function ProductGrid({ products, page, pageSize }: Props) {
|
|
|
26
31
|
product={product}
|
|
27
32
|
index={pageSize * page + idx + 1}
|
|
28
33
|
bordered
|
|
34
|
+
aspectRatio={aspectRatio}
|
|
29
35
|
/>
|
|
30
36
|
</li>
|
|
31
37
|
))}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import UIProvider,
|
|
1
|
+
import { UIProvider, useUI, Button } from '@faststore/ui'
|
|
2
2
|
|
|
3
3
|
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ import Icon from '../ui/Icon'
|
|
|
15
15
|
<Meta title="Features/Regionalization/Overview" />
|
|
16
16
|
|
|
17
17
|
export const TemplateRegionalizationModal = () => {
|
|
18
|
-
const { modal
|
|
18
|
+
const { modal } = useUI()
|
|
19
19
|
return <>{modal && <RegionalizationModal />}</>
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -31,6 +31,26 @@ export const TemplateButtonWithProvider = () => {
|
|
|
31
31
|
)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export const RegionalizationModalContentTemplate = () => {
|
|
35
|
+
const { modal, openModal } = useUI()
|
|
36
|
+
return (
|
|
37
|
+
<div>
|
|
38
|
+
<Button variant="primary" onClick={() => openModal()}>
|
|
39
|
+
Open Regionalization Modal
|
|
40
|
+
</Button>
|
|
41
|
+
{modal && <RegionalizationModal />}
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const TemplateOverview = (args) => {
|
|
47
|
+
return (
|
|
48
|
+
<UIProvider>
|
|
49
|
+
<RegionalizationModalContentTemplate onClose={() => {}} />
|
|
50
|
+
</UIProvider>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
34
54
|
<header>
|
|
35
55
|
|
|
36
56
|
# Regionalization
|
|
@@ -120,9 +140,7 @@ With the Regionalization feature enabled, if a customer enters their Postal Code
|
|
|
120
140
|
</li>
|
|
121
141
|
<li>
|
|
122
142
|
<div>
|
|
123
|
-
<
|
|
124
|
-
<RegionalizationModalContent onClose={() => {}} />
|
|
125
|
-
</UIProvider>
|
|
143
|
+
<TemplateOverview />
|
|
126
144
|
</div>
|
|
127
145
|
<article className="sbdocs-list-text">
|
|
128
146
|
<h3>RegionalizationModal</h3>
|
|
@@ -153,7 +171,7 @@ On your `Layout.tsx` file:
|
|
|
153
171
|
|
|
154
172
|
```jsx
|
|
155
173
|
import RegionalizationModal from '../components/regionalization/RegionalizationModal'
|
|
156
|
-
import { useUI } from '
|
|
174
|
+
import { useUI } from '@faststore/ui'
|
|
157
175
|
```
|
|
158
176
|
|
|
159
177
|
and inside your `Layout` component:
|
|
@@ -3,7 +3,7 @@ import { Button as UIButton } from '@faststore/ui'
|
|
|
3
3
|
|
|
4
4
|
import Icon from 'src/components/ui/Icon'
|
|
5
5
|
import { useSession } from 'src/sdk/session'
|
|
6
|
-
import { useUI } from '
|
|
6
|
+
import { useUI } from '@faststore/ui'
|
|
7
7
|
|
|
8
8
|
import styles from './regionalization-bar.module.scss'
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@ import { Button as UIButton } from '@faststore/ui'
|
|
|
2
2
|
|
|
3
3
|
import Icon from 'src/components/ui/Icon'
|
|
4
4
|
import { useSession } from 'src/sdk/session'
|
|
5
|
-
import { useUI } from '
|
|
5
|
+
import { useUI } from '@faststore/ui'
|
|
6
6
|
|
|
7
7
|
function RegionButton() {
|
|
8
8
|
const { openModal } = useUI()
|
package/src/components/regionalization/RegionalizationModal/RegionalizationModal.stories.mdx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { UIProvider, useUI, Modal, Button } from '@faststore/ui'
|
|
3
4
|
|
|
4
5
|
import RegionalizationModal, { RegionalizationModalContent } from '.'
|
|
5
6
|
import RegionalizationButton from 'src/components/regionalization/RegionalizationButton'
|
|
@@ -35,10 +36,22 @@ export const Template = (args) => {
|
|
|
35
36
|
)
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
export const RegionalizationModalContentTemplate = (
|
|
39
|
+
export const RegionalizationModalContentTemplate = () => {
|
|
40
|
+
const { modal, openModal } = useUI()
|
|
41
|
+
return (
|
|
42
|
+
<div>
|
|
43
|
+
<Button variant="primary" onClick={() => openModal()}>
|
|
44
|
+
Open Regionalization Modal
|
|
45
|
+
</Button>
|
|
46
|
+
{modal && <RegionalizationModal />}
|
|
47
|
+
</div>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const TemplateOverview = (args) => {
|
|
39
52
|
return (
|
|
40
53
|
<UIProvider>
|
|
41
|
-
<
|
|
54
|
+
<RegionalizationModalContentTemplate onClose={() => {}} />
|
|
42
55
|
</UIProvider>
|
|
43
56
|
)
|
|
44
57
|
}
|
|
@@ -56,7 +69,7 @@ This component calls a modal with some regionalization configurations.
|
|
|
56
69
|
The `RegionalizationModal` is part of [Regionalization](?path=/docs/features-regionalization-overview--default-button) feature and uses [Modal](/docs/molecules-modal--overview) as a base.
|
|
57
70
|
|
|
58
71
|
<Canvas style={{ backgroundColor: 'var(--fs-color-neutral-1)' }}>
|
|
59
|
-
<Story name="Overview">{
|
|
72
|
+
<Story name="Overview">{TemplateOverview.bind({})}</Story>
|
|
60
73
|
</Canvas>
|
|
61
74
|
|
|
62
75
|
---
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import Modal from '
|
|
2
|
-
|
|
3
|
-
import { RegionalizationModalContent } from '.'
|
|
1
|
+
import { Modal as UIModal } from '@faststore/ui'
|
|
2
|
+
import RegionalizationModalContent from './RegionalizationModalContent'
|
|
4
3
|
|
|
5
4
|
function RegionalizationModal() {
|
|
6
5
|
return (
|
|
7
|
-
<
|
|
6
|
+
<UIModal>
|
|
8
7
|
{({ fadeOut }) => <RegionalizationModalContent onClose={fadeOut} />}
|
|
9
|
-
</
|
|
8
|
+
</UIModal>
|
|
10
9
|
)
|
|
11
10
|
}
|
|
12
11
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ModalBody as UIModalBody,
|
|
3
|
+
ModalHeader as UIModalHeader,
|
|
4
|
+
} from '@faststore/ui'
|
|
2
5
|
|
|
3
6
|
import RegionalizationInput from 'src/components/regionalization/RegionalizationInput'
|
|
4
7
|
import Icon from 'src/components/ui/Icon'
|
|
5
8
|
import Link from 'src/components/ui/Link'
|
|
6
9
|
|
|
7
|
-
import styles from './regionalization-modal-
|
|
10
|
+
import styles from './regionalization-modal-body.module.scss'
|
|
8
11
|
|
|
9
|
-
export
|
|
12
|
+
export interface RegionalizationModalContentProps {
|
|
10
13
|
onClose?: () => void
|
|
11
14
|
}
|
|
12
15
|
|
|
@@ -14,35 +17,25 @@ function RegionalizationModalContent({
|
|
|
14
17
|
onClose,
|
|
15
18
|
}: RegionalizationModalContentProps) {
|
|
16
19
|
return (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
data-testid="regionalization-modal-button-close"
|
|
28
|
-
icon={<Icon name="X" width={30} height={30} />}
|
|
29
|
-
/>
|
|
30
|
-
)}
|
|
31
|
-
<p data-fs-regionalization-modal-title>Set your location</p>
|
|
32
|
-
<p data-fs-regionalization-modal-description>
|
|
33
|
-
Prices, offers and availability may vary according to your location.
|
|
34
|
-
</p>
|
|
35
|
-
</header>
|
|
36
|
-
<div data-fs-regionalization-modal-body>
|
|
20
|
+
<>
|
|
21
|
+
<UIModalHeader
|
|
22
|
+
onClose={() => onClose()}
|
|
23
|
+
title="Set your location"
|
|
24
|
+
description="Prices, offers and availability may vary according to your location."
|
|
25
|
+
closeButtonProps={{
|
|
26
|
+
'aria-label': 'Close Regionalization Modal',
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
<UIModalBody className={styles.fsRegionalizationModalBody}>
|
|
37
30
|
<div data-fs-regionalization-modal-input>
|
|
38
|
-
<RegionalizationInput closeModal={() => onClose
|
|
31
|
+
<RegionalizationInput closeModal={() => onClose()} />
|
|
39
32
|
</div>
|
|
40
33
|
<Link href="/" data-fs-regionalization-modal-link>
|
|
41
34
|
{"I don't know my Postal Code"}
|
|
42
35
|
<Icon name="ArrowSquareOut" width={18} height={18} />
|
|
43
36
|
</Link>
|
|
44
|
-
</
|
|
45
|
-
|
|
37
|
+
</UIModalBody>
|
|
38
|
+
</>
|
|
46
39
|
)
|
|
47
40
|
}
|
|
48
41
|
|
package/src/components/regionalization/RegionalizationModal/regionalization-modal-body.module.scss
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.fs-regionalization-modal-body {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Regionalization Modal
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Link
|
|
7
|
+
--fs-regionalization-modal-link-padding: 0;
|
|
8
|
+
--fs-regionalization-modal-link-color: var(--fs-color-link);
|
|
9
|
+
--fs-regionalization-modal-link-margin-right: var(--fs-spacing-0);
|
|
10
|
+
|
|
11
|
+
[data-fs-regionalization-modal-input] {
|
|
12
|
+
margin-bottom: var(--fs-spacing-6);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[data-fs-regionalization-modal-link] {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
align-content: flex-start;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: flex-start;
|
|
21
|
+
padding: var(--fs-regionalization-modal-link-padding);
|
|
22
|
+
margin-right: var(--fs-regionalization-modal-link-margin-right);
|
|
23
|
+
color: var(--fs-regionalization-modal-link-color);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SearchProvider } from '@faststore/sdk'
|
|
2
2
|
import { useSearch } from '@faststore/sdk'
|
|
3
3
|
|
|
4
|
-
import UIProvider,
|
|
4
|
+
import { UIProvider, useUI } from '@faststore/ui'
|
|
5
5
|
import { validateSession } from 'src/sdk/session'
|
|
6
6
|
import { useFilter } from './useFilter'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SearchProvider } from '@faststore/sdk'
|
|
2
2
|
import { useSearch } from '@faststore/sdk'
|
|
3
3
|
|
|
4
|
-
import UIProvider,
|
|
4
|
+
import { UIProvider, useUI } from '@faststore/ui'
|
|
5
5
|
import { validateSession } from 'src/sdk/session'
|
|
6
6
|
import { useFilter } from './useFilter'
|
|
7
7
|
|
|
@@ -2,7 +2,7 @@ import { gql } from '@faststore/graphql-utils'
|
|
|
2
2
|
import { setFacet, toggleFacet, useSearch } from '@faststore/sdk'
|
|
3
3
|
|
|
4
4
|
import type { Filter_FacetsFragment } from '@generated/graphql'
|
|
5
|
-
import { useUI } from '
|
|
5
|
+
import { useUI } from '@faststore/ui'
|
|
6
6
|
|
|
7
7
|
import Facets from './Facets'
|
|
8
8
|
import FilterSlider from './FilterSlider'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SearchProvider } from '@faststore/sdk'
|
|
2
2
|
import { useSearch } from '@faststore/sdk'
|
|
3
3
|
|
|
4
|
-
import UIProvider,
|
|
4
|
+
import { UIProvider, useUI } from '@faststore/ui'
|
|
5
5
|
import { validateSession } from 'src/sdk/session'
|
|
6
6
|
import { useFilter } from './useFilter'
|
|
7
7
|
|
|
@@ -4,8 +4,8 @@ import { Button as UIButton, IconButton as UIIconButton } from '@faststore/ui'
|
|
|
4
4
|
import type { Filter_FacetsFragment } from '@generated/graphql'
|
|
5
5
|
import Icon from 'src/components/ui/Icon'
|
|
6
6
|
import SlideOver from 'src/components/ui/SlideOver'
|
|
7
|
-
import { useUI } from '
|
|
8
|
-
import { useFadeEffect } from '
|
|
7
|
+
import { useUI } from '@faststore/ui'
|
|
8
|
+
import { useFadeEffect } from '@faststore/ui'
|
|
9
9
|
|
|
10
10
|
import Facets from './Facets'
|
|
11
11
|
import styles from './filter-slider.module.scss'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs'
|
|
2
2
|
import { TokenTable, TokenRow } from 'src/../.storybook/components'
|
|
3
3
|
|
|
4
|
-
import UIProvider from '
|
|
4
|
+
import { UIProvider } from '@faststore/ui'
|
|
5
5
|
|
|
6
6
|
import Newsletter from '.'
|
|
7
7
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
InputField as UIInputField,
|
|
7
7
|
} from '@faststore/ui'
|
|
8
8
|
|
|
9
|
-
import { useUI } from '
|
|
9
|
+
import { useUI } from '@faststore/ui'
|
|
10
10
|
import Icon from 'src/components/ui/Icon'
|
|
11
11
|
import Link from 'src/components/ui/Link'
|
|
12
12
|
import { useNewsletter } from 'src/sdk/newsletter/useNewsletter'
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
BuyButton as UIBuyButton,
|
|
7
7
|
DiscountBadge as UIDiscountBadge,
|
|
8
8
|
QuantitySelector as UIQuantitySelector,
|
|
9
|
+
ProductTitle as UIProductTitle,
|
|
9
10
|
} from '@faststore/ui'
|
|
10
11
|
|
|
11
12
|
import type { ProductDetailsFragment_ProductFragment } from '@generated/graphql'
|
|
@@ -13,7 +14,6 @@ import OutOfStock from 'src/components/product/OutOfStock'
|
|
|
13
14
|
import Breadcrumb from 'src/components/ui/Breadcrumb'
|
|
14
15
|
import { ImageGallery } from 'src/components/ui/ImageGallery'
|
|
15
16
|
import Price from 'src/components/ui/Price'
|
|
16
|
-
import ProductTitle from 'src/components/ui/ProductTitle'
|
|
17
17
|
import ShippingSimulation from 'src/components/ui/ShippingSimulation'
|
|
18
18
|
import Selectors from 'src/components/ui/SkuSelector'
|
|
19
19
|
import type { AnalyticsItem } from 'src/sdk/analytics/types'
|
|
@@ -122,7 +122,7 @@ function ProductDetails({ context: staleProduct }: Props) {
|
|
|
122
122
|
|
|
123
123
|
<section data-fs-product-details-body>
|
|
124
124
|
<header data-fs-product-details-title data-fs-product-details-section>
|
|
125
|
-
<
|
|
125
|
+
<UIProductTitle
|
|
126
126
|
title={<h1>{name}</h1>}
|
|
127
127
|
label={
|
|
128
128
|
<UIDiscountBadge
|
|
@@ -2,16 +2,19 @@ import { useSearch } from '@faststore/sdk'
|
|
|
2
2
|
import { NextSeo } from 'next-seo'
|
|
3
3
|
import { lazy, Suspense } from 'react'
|
|
4
4
|
import type { MouseEvent } from 'react'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Button as UIButton,
|
|
7
|
+
LinkButton as UILinkButton,
|
|
8
|
+
Skeleton as UISkeleton,
|
|
9
|
+
} from '@faststore/ui'
|
|
6
10
|
|
|
7
11
|
import Filter from 'src/components/search/Filter'
|
|
8
12
|
import Sort from 'src/components/search/Sort'
|
|
9
13
|
import FilterSkeleton from 'src/components/skeletons/FilterSkeleton'
|
|
10
14
|
import ProductGridSkeleton from 'src/components/skeletons/ProductGridSkeleton'
|
|
11
|
-
import Skeleton from 'src/components/skeletons/Skeleton'
|
|
12
15
|
import Icon from 'src/components/ui/Icon'
|
|
13
16
|
import { mark } from 'src/sdk/tests/mark'
|
|
14
|
-
import { useUI } from '
|
|
17
|
+
import { useUI } from '@faststore/ui'
|
|
15
18
|
|
|
16
19
|
import Section from '../Section'
|
|
17
20
|
import EmptyGallery from './EmptyGallery'
|
|
@@ -74,31 +77,28 @@ function ProductGallery({ title, searchTerm }: Props) {
|
|
|
74
77
|
</div>
|
|
75
78
|
|
|
76
79
|
<div data-fs-product-listing-results-count data-count={totalCount}>
|
|
77
|
-
<
|
|
78
|
-
shimmer
|
|
79
|
-
variant="text"
|
|
80
|
-
loading={!data}
|
|
80
|
+
<UISkeleton
|
|
81
81
|
data-fs-product-listing-results-count-skeleton
|
|
82
|
+
loading={!data}
|
|
83
|
+
size={{ width: '100%', height: '1.5rem' }}
|
|
82
84
|
>
|
|
83
85
|
<h2 data-testid="total-product-count">{totalCount} Results</h2>
|
|
84
|
-
</
|
|
86
|
+
</UISkeleton>
|
|
85
87
|
</div>
|
|
86
88
|
|
|
87
89
|
<div data-fs-product-listing-sort>
|
|
88
|
-
<
|
|
89
|
-
shimmer
|
|
90
|
-
variant="text"
|
|
91
|
-
loading={facets?.length === 0}
|
|
90
|
+
<UISkeleton
|
|
92
91
|
data-fs-product-listing-sort-skeleton
|
|
92
|
+
loading={facets?.length === 0}
|
|
93
|
+
size={{ width: 'auto', height: '1.5rem' }}
|
|
93
94
|
>
|
|
94
95
|
<Sort />
|
|
95
|
-
</
|
|
96
|
+
</UISkeleton>
|
|
96
97
|
|
|
97
|
-
<
|
|
98
|
-
shimmer
|
|
99
|
-
variant="button"
|
|
100
|
-
loading={facets?.length === 0}
|
|
98
|
+
<UISkeleton
|
|
101
99
|
data-fs-product-listing-filter-button-skeleton
|
|
100
|
+
loading={facets?.length === 0}
|
|
101
|
+
size={{ width: '6rem', height: '1.5rem' }}
|
|
102
102
|
>
|
|
103
103
|
<UIButton
|
|
104
104
|
variant="tertiary"
|
|
@@ -110,7 +110,7 @@ function ProductGallery({ title, searchTerm }: Props) {
|
|
|
110
110
|
>
|
|
111
111
|
Filters
|
|
112
112
|
</UIButton>
|
|
113
|
-
</
|
|
113
|
+
</UISkeleton>
|
|
114
114
|
</div>
|
|
115
115
|
|
|
116
116
|
<div data-fs-product-listing-results>
|
|
@@ -24,6 +24,7 @@ function ProductShelf({
|
|
|
24
24
|
const { ref, inView } = useInView()
|
|
25
25
|
const products = useProductsQuery(variables)
|
|
26
26
|
const productEdges = products?.edges ?? []
|
|
27
|
+
const aspectRatio = 1
|
|
27
28
|
|
|
28
29
|
const { sendViewItemListEvent } = useViewItemListEvent({
|
|
29
30
|
products: productEdges,
|
|
@@ -51,11 +52,18 @@ function ProductShelf({
|
|
|
51
52
|
>
|
|
52
53
|
<h2 className="text__title-section layout__content">{title}</h2>
|
|
53
54
|
<div className={styles.fsProductShelf} data-fs-product-shelf>
|
|
54
|
-
<ProductShelfSkeleton
|
|
55
|
+
<ProductShelfSkeleton
|
|
56
|
+
aspectRatio={aspectRatio}
|
|
57
|
+
loading={products === undefined}
|
|
58
|
+
>
|
|
55
59
|
<ul data-fs-product-shelf-items className="layout__content">
|
|
56
60
|
{productEdges.map((product, idx) => (
|
|
57
61
|
<li key={`${product.node.id}`}>
|
|
58
|
-
<ProductCard
|
|
62
|
+
<ProductCard
|
|
63
|
+
product={product.node}
|
|
64
|
+
index={idx + 1}
|
|
65
|
+
aspectRatio={aspectRatio}
|
|
66
|
+
/>
|
|
59
67
|
</li>
|
|
60
68
|
))}
|
|
61
69
|
</ul>
|
|
@@ -25,7 +25,7 @@ const getRatio = (products: number, idx: number) => {
|
|
|
25
25
|
products === NUMBER_ITEMS_TO_EXPAND_FIRST_TWO && (idx === 0 || idx === 1)
|
|
26
26
|
|
|
27
27
|
if (expandsFirstTile || expandsFirstTwoTile) {
|
|
28
|
-
return
|
|
28
|
+
return 5 / 3
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return 3 / 4
|
|
@@ -60,7 +60,7 @@ const ProductTiles = ({ title, ...variables }: ProductTilesProps) => {
|
|
|
60
60
|
<Section className="layout__section layout__content" ref={ref}>
|
|
61
61
|
<h2 className="text__title-section">{title}</h2>
|
|
62
62
|
<div>
|
|
63
|
-
<ProductTilesSkeleton
|
|
63
|
+
<ProductTilesSkeleton loading={!products}>
|
|
64
64
|
<Tiles>
|
|
65
65
|
{productEdges.map((product, idx) => (
|
|
66
66
|
<Tile key={product.node.id}>
|
|
@@ -31,7 +31,7 @@ The loading placeholder for the <code>Filter</code> component used in PLP.
|
|
|
31
31
|
|
|
32
32
|
## Overview
|
|
33
33
|
|
|
34
|
-
The `FilterSkeleton` component is part of
|
|
34
|
+
The `FilterSkeleton` component is part of Skeletons feature.
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|