@faststore/core 0.3.16 → 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 +127 -169
- package/README.md +2 -2
- package/cypress/integration/analytics.test.js +4 -4
- package/cypress/integration/cart.test.js +2 -2
- package/cypress/integration/plp.test.js +9 -9
- package/package.json +9 -10
- package/src/Layout.tsx +7 -2
- 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 +13 -17
- package/src/components/cart/CartSidebar/cart-sidebar.module.scss +2 -0
- package/src/components/common/Alert/Alert.tsx +6 -22
- package/src/components/common/Footer/Footer.stories.mdx +1 -1
- package/src/components/common/Footer/Footer.tsx +5 -38
- package/src/components/common/Footer/FooterFlags.tsx +23 -0
- package/src/components/common/Footer/FooterLinks.tsx +16 -12
- 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 +10 -10
- package/src/components/search/Filter/Facets.tsx +69 -61
- 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/search/Filter/facets.module.scss +16 -16
- package/src/components/search/Search.stories.mdx +28 -24
- package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -1
- package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -1
- package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -1
- package/src/components/sections/Newsletter/Newsletter.stories.mdx +1 -1
- package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
- package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +146 -146
- package/src/components/sections/ProductDetails/ProductDetails.tsx +4 -4
- 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/Breadcrumb/Breadcrumb.tsx +17 -16
- package/src/components/ui/Gift/Gift.tsx +18 -27
- package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
- 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 +4 -6
- 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/Accordion/Accordion.stories.mdx +0 -222
- package/src/components/ui/Accordion/Accordion.tsx +0 -39
- package/src/components/ui/Accordion/AccordionItem.stories.mdx +0 -116
- package/src/components/ui/Accordion/AccordionItem.tsx +0 -82
- package/src/components/ui/Accordion/accordion.module.scss +0 -65
- package/src/components/ui/Accordion/index.ts +0 -2
- package/src/components/ui/Alert/Alert.stories.mdx +0 -164
- package/src/components/ui/Alert/Alert.tsx +0 -81
- package/src/components/ui/Alert/alert.module.scss +0 -93
- package/src/components/ui/Alert/index.ts +0 -1
- package/src/components/ui/Dropdown/Dropdown.stories.mdx +0 -232
- package/src/components/ui/Dropdown/Dropdown.tsx +0 -12
- package/src/components/ui/Dropdown/DropdownButton.tsx +0 -20
- package/src/components/ui/Dropdown/DropdownItem.stories.mdx +0 -139
- package/src/components/ui/Dropdown/DropdownItem.tsx +0 -26
- package/src/components/ui/Dropdown/DropdownMenu.stories.mdx +0 -115
- package/src/components/ui/Dropdown/DropdownMenu.tsx +0 -34
- package/src/components/ui/Dropdown/dropdown.module.scss +0 -101
- package/src/components/ui/Dropdown/index.ts +0 -4
- package/src/components/ui/Gift/Gift.stories.mdx +0 -99
- package/src/components/ui/Gift/gift.module.scss +0 -94
- 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/PriceRange/PriceRange.stories.mdx +0 -192
- package/src/components/ui/PriceRange/PriceRange.tsx +0 -140
- package/src/components/ui/PriceRange/index.ts +0 -1
- package/src/components/ui/PriceRange/price-range.module.scss +0 -176
- 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/components/ui/QuantitySelector/QuantitySelector.stories.mdx +0 -246
- package/src/components/ui/QuantitySelector/QuantitySelector.tsx +0 -103
- package/src/components/ui/QuantitySelector/index.ts +0 -1
- package/src/components/ui/QuantitySelector/quantity-selector.module.scss +0 -155
- package/src/sdk/ui/Provider.tsx +0 -151
- package/src/sdk/ui/useFadeEffect.ts +0 -21
|
@@ -22,11 +22,6 @@
|
|
|
22
22
|
--fs-footer-title-weight : var(--fs-text-weight-bold);
|
|
23
23
|
--fs-footer-title-margin-bottom : var(--fs-spacing-1);
|
|
24
24
|
|
|
25
|
-
// Payment Methods
|
|
26
|
-
--fs-footer-payment-methods-flags-border-width : var(--fs-border-width);
|
|
27
|
-
--fs-footer-payment-methods-flags-border-color : var(--fs-color-neutral-3);
|
|
28
|
-
--fs-footer-payment-methods-flags-border-radius : var(--fs-border-radius-small);
|
|
29
|
-
|
|
30
25
|
// --------------------------------------------------------
|
|
31
26
|
// Structural Styles
|
|
32
27
|
// --------------------------------------------------------
|
|
@@ -108,7 +103,7 @@
|
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
[data-fs-footer-social],
|
|
111
|
-
[data-fs-
|
|
106
|
+
[data-fs-payment-methods] {
|
|
112
107
|
@include media(">=notebook") {
|
|
113
108
|
grid-column: 11 / span 2;
|
|
114
109
|
margin-left: calc(-1 * var(--fs-spacing-3));
|
|
@@ -142,7 +137,7 @@
|
|
|
142
137
|
}
|
|
143
138
|
}
|
|
144
139
|
|
|
145
|
-
[data-fs-
|
|
140
|
+
[data-fs-payment-methods] {
|
|
146
141
|
@include media("<notebook") {
|
|
147
142
|
margin: var(--fs-footer-spacing-vertical-mobile) auto;
|
|
148
143
|
}
|
|
@@ -158,27 +153,6 @@
|
|
|
158
153
|
}
|
|
159
154
|
}
|
|
160
155
|
|
|
161
|
-
[data-payment-methods-flags] {
|
|
162
|
-
svg {
|
|
163
|
-
border: var(--fs-footer-payment-methods-flags-border-width) solid var(--fs-footer-payment-methods-flags-border-color);
|
|
164
|
-
border-radius: var(--fs-footer-payment-methods-flags-border-radius);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
[data-fs-list] {
|
|
168
|
-
display: grid;
|
|
169
|
-
grid-template-columns: repeat(4, minmax(0, max-content));
|
|
170
|
-
row-gap: var(--fs-spacing-1);
|
|
171
|
-
justify-content: space-between;
|
|
172
|
-
margin-top: var(--fs-spacing-3);
|
|
173
|
-
|
|
174
|
-
li { display: flex; }
|
|
175
|
-
|
|
176
|
-
@include media("<notebook") {
|
|
177
|
-
column-gap: var(--fs-grid-gap-2);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
156
|
[data-fs-footer-copyright] {
|
|
183
157
|
p + p {
|
|
184
158
|
margin: var(--fs-spacing-2) auto;
|
|
@@ -9,7 +9,7 @@ import Icon from 'src/components/ui/Icon'
|
|
|
9
9
|
import Link from 'src/components/ui/Link'
|
|
10
10
|
import Logo from 'src/components/ui/Logo'
|
|
11
11
|
import { mark } from 'src/sdk/tests/mark'
|
|
12
|
-
import { useUI } from '
|
|
12
|
+
import { useUI } from '@faststore/ui'
|
|
13
13
|
import useScrollDirection from 'src/sdk/ui/useScrollDirection'
|
|
14
14
|
|
|
15
15
|
import styles from './navbar.module.scss'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
2
|
|
|
3
|
-
import UIProvider,
|
|
3
|
+
import { UIProvider, useUI } from '@faststore/ui'
|
|
4
4
|
|
|
5
5
|
import { Button } from '@faststore/ui'
|
|
6
6
|
import Icon from 'src/components/ui/Icon'
|
|
@@ -7,8 +7,8 @@ import Link from 'src/components/ui/Link'
|
|
|
7
7
|
import Logo from 'src/components/ui/Logo'
|
|
8
8
|
import SlideOver from 'src/components/ui/SlideOver'
|
|
9
9
|
import { mark } from 'src/sdk/tests/mark'
|
|
10
|
-
import { useUI } from '
|
|
11
|
-
import { useFadeEffect } from '
|
|
10
|
+
import { useUI } from '@faststore/ui'
|
|
11
|
+
import { useFadeEffect } from '@faststore/ui'
|
|
12
12
|
|
|
13
13
|
import styles from './navbar-slider.module.scss'
|
|
14
14
|
import NavLinks from './NavLinks'
|
|
@@ -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
|
|
|
@@ -134,7 +134,7 @@ Facets represent the <code>Filter</code> details and allow users to refine their
|
|
|
134
134
|
|
|
135
135
|
## Overview
|
|
136
136
|
|
|
137
|
-
The `Facets` component uses the
|
|
137
|
+
The `Facets` component uses the Accordion, [Checkbox](?path=/docs/atoms-checkbox--overview-default), PriceRange, and [Badge](?path=/docs/molecules-badge--default) components.
|
|
138
138
|
|
|
139
139
|
---
|
|
140
140
|
|
|
@@ -194,30 +194,30 @@ The `Facets` component uses the [Accordion](?path=/docs/molecules-accordion-over
|
|
|
194
194
|
|
|
195
195
|
<TokenTable>
|
|
196
196
|
<TokenRow
|
|
197
|
-
token="--fs-facets-accordion-
|
|
197
|
+
token="--fs-facets-accordion-button-text-size"
|
|
198
198
|
value="var(--fs-text-size-lead)"
|
|
199
199
|
/>
|
|
200
200
|
<TokenRow
|
|
201
|
-
token="--fs-facets-accordion-
|
|
201
|
+
token="--fs-facets-accordion-button-text-weight"
|
|
202
202
|
value="var(--fs-text-weight-regular)"
|
|
203
203
|
/>
|
|
204
|
-
<TokenRow token="--fs-facets-accordion-
|
|
204
|
+
<TokenRow token="--fs-facets-accordion-button-line-height" value="1.5" />
|
|
205
205
|
<TokenDivider />
|
|
206
206
|
<TokenRow
|
|
207
|
-
token="--fs-facets-accordion-
|
|
207
|
+
token="--fs-facets-accordion-button-text-weight-notebook"
|
|
208
208
|
value="var(--fs-text-size-2)"
|
|
209
209
|
/>
|
|
210
210
|
<TokenRow
|
|
211
|
-
token="--fs-facets-accordion-
|
|
211
|
+
token="--fs-facets-accordion-button-line-height-notebook"
|
|
212
212
|
value="1.25"
|
|
213
213
|
/>
|
|
214
214
|
<TokenRow
|
|
215
|
-
token="--fs-facets-accordion-
|
|
215
|
+
token="--fs-facets-accordion-button-padding-right-notebook"
|
|
216
216
|
value="var(--fs-spacing-4)"
|
|
217
217
|
/>
|
|
218
218
|
<TokenRow
|
|
219
|
-
token="--fs-facets-accordion-
|
|
220
|
-
value="var(--fs-facets-accordion-
|
|
219
|
+
token="--fs-facets-accordion-button-padding-left-notebook"
|
|
220
|
+
value="var(--fs-facets-accordion-button-padding-right-notebook)"
|
|
221
221
|
/>
|
|
222
222
|
</TokenTable>
|
|
223
223
|
|