@magento/venia-pwa-live-search 1.0.0-alpha6
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/package.json +31 -0
- package/postcss.config.js +3 -0
- package/src/api/fragments.js +193 -0
- package/src/api/graphql.js +26 -0
- package/src/api/mutations.js +94 -0
- package/src/api/queries.js +225 -0
- package/src/api/search.js +222 -0
- package/src/components/AddToCartButton/AddToCartButton.jsx +32 -0
- package/src/components/AddToCartButton/AddToCartButton.stories.mdx +14 -0
- package/src/components/AddToCartButton/index.js +10 -0
- package/src/components/Alert/Alert.jsx +155 -0
- package/src/components/Alert/index.js +11 -0
- package/src/components/Breadcrumbs/Breadcrumbs.jsx +34 -0
- package/src/components/Breadcrumbs/MockPages.js +14 -0
- package/src/components/Breadcrumbs/index.js +11 -0
- package/src/components/ButtonShimmer/ButtonShimmer.css +32 -0
- package/src/components/ButtonShimmer/ButtonShimmer.jsx +23 -0
- package/src/components/ButtonShimmer/index.js +11 -0
- package/src/components/CategoryFilters/CategoryFilters.jsx +59 -0
- package/src/components/CategoryFilters/index.js +10 -0
- package/src/components/Facets/Facets.jsx +50 -0
- package/src/components/Facets/Range/RangeFacet.js +20 -0
- package/src/components/Facets/Scalar/ScalarFacet.js +29 -0
- package/src/components/Facets/SelectedFilters.js +80 -0
- package/src/components/Facets/format.js +52 -0
- package/src/components/Facets/index.js +14 -0
- package/src/components/Facets/mocks.js +119 -0
- package/src/components/FacetsShimmer/FacetsShimmer.css +49 -0
- package/src/components/FacetsShimmer/FacetsShimmer.jsx +25 -0
- package/src/components/FacetsShimmer/index.js +11 -0
- package/src/components/FilterButton/FilterButton.jsx +40 -0
- package/src/components/FilterButton/index.js +11 -0
- package/src/components/ImageCarousel/Image.jsx +34 -0
- package/src/components/ImageCarousel/ImageCarousel.jsx +103 -0
- package/src/components/ImageCarousel/index.js +11 -0
- package/src/components/InputButtonGroup/InputButtonGroup.jsx +120 -0
- package/src/components/InputButtonGroup/index.js +11 -0
- package/src/components/LabelledInput/LabelledInput.jsx +51 -0
- package/src/components/LabelledInput/index.js +11 -0
- package/src/components/Loading/Loading.jsx +32 -0
- package/src/components/Loading/index.js +11 -0
- package/src/components/NoResults/NoResults.jsx +55 -0
- package/src/components/NoResults/index.js +11 -0
- package/src/components/Pagination/Pagination.jsx +105 -0
- package/src/components/Pagination/index.js +10 -0
- package/src/components/PerPagePicker/PerPagePicker.jsx +114 -0
- package/src/components/PerPagePicker/index.js +11 -0
- package/src/components/Pill/Pill.jsx +34 -0
- package/src/components/Pill/index.js +11 -0
- package/src/components/Pill/mock.js +23 -0
- package/src/components/ProductCardShimmer/ProductCardShimmer.css +72 -0
- package/src/components/ProductCardShimmer/ProductCardShimmer.jsx +28 -0
- package/src/components/ProductCardShimmer/index.js +11 -0
- package/src/components/ProductItem/MockData.js +508 -0
- package/src/components/ProductItem/ProductItem.css +84 -0
- package/src/components/ProductItem/ProductItem.jsx +347 -0
- package/src/components/ProductItem/ProductPrice.jsx +181 -0
- package/src/components/ProductItem/index.js +11 -0
- package/src/components/ProductList/MockData.js +190 -0
- package/src/components/ProductList/ProductList.jsx +127 -0
- package/src/components/ProductList/index.js +11 -0
- package/src/components/ProductList/product-list.css +18 -0
- package/src/components/SearchBar/SearchBar.jsx +33 -0
- package/src/components/SearchBar/index.js +11 -0
- package/src/components/Shimmer/Shimmer.css +82 -0
- package/src/components/Shimmer/Shimmer.jsx +66 -0
- package/src/components/Shimmer/index.js +11 -0
- package/src/components/Slider/Slider.css +61 -0
- package/src/components/Slider/Slider.jsx +103 -0
- package/src/components/Slider/index.jsx +11 -0
- package/src/components/SliderDoubleControl/SliderDoubleControl.css +83 -0
- package/src/components/SliderDoubleControl/SliderDoubleControl.jsx +220 -0
- package/src/components/SliderDoubleControl/index.js +11 -0
- package/src/components/SortDropdown/SortDropdown.jsx +126 -0
- package/src/components/SortDropdown/index.js +11 -0
- package/src/components/SwatchButton/SwatchButton.jsx +72 -0
- package/src/components/SwatchButton/index.js +11 -0
- package/src/components/SwatchButtonGroup/SwatchButtonGroup.jsx +86 -0
- package/src/components/SwatchButtonGroup/index.js +11 -0
- package/src/components/ViewSwitcher/ViewSwitcher.jsx +46 -0
- package/src/components/ViewSwitcher/index.js +11 -0
- package/src/components/WishlistButton/WishlistButton.jsx +67 -0
- package/src/components/WishlistButton/index.js +11 -0
- package/src/containers/App.jsx +145 -0
- package/src/containers/LiveSearchPLPLoader.jsx +24 -0
- package/src/containers/LiveSearchPopoverLoader.jsx +190 -0
- package/src/containers/LiveSearchSRLPLoader.jsx +24 -0
- package/src/containers/ProductListingPage.jsx +66 -0
- package/src/containers/ProductsContainer.jsx +145 -0
- package/src/containers/ProductsHeader.jsx +123 -0
- package/src/context/attributeMetadata.js +63 -0
- package/src/context/cart.js +97 -0
- package/src/context/displayChange.js +90 -0
- package/src/context/events.js +160 -0
- package/src/context/index.js +19 -0
- package/src/context/products.jsx +336 -0
- package/src/context/resultsModifierContext.js +35 -0
- package/src/context/search.jsx +127 -0
- package/src/context/store.jsx +93 -0
- package/src/context/translation.jsx +125 -0
- package/src/context/widgetConfig.jsx +120 -0
- package/src/context/wishlist.jsx +97 -0
- package/src/hooks/eventing/useEventListener.js +13 -0
- package/src/hooks/eventing/useLocation.js +21 -0
- package/src/hooks/eventing/useMagentoExtensionContext.js +28 -0
- package/src/hooks/eventing/usePageView.js +36 -0
- package/src/hooks/eventing/useShopperContext.js +33 -0
- package/src/hooks/eventing/useStorefrontInstanceContext.js +46 -0
- package/src/hooks/eventing/useViewedOffsets.js +74 -0
- package/src/hooks/useAccessibleDropdown.js +148 -0
- package/src/hooks/useLiveSearchPLPConfig.js +112 -0
- package/src/hooks/useLiveSearchPopoverConfig.js +83 -0
- package/src/hooks/useLiveSearchSRLPConfig.js +97 -0
- package/src/hooks/usePagination.js +83 -0
- package/src/hooks/useRangeFacet.js +62 -0
- package/src/hooks/useScalarFacet.js +61 -0
- package/src/hooks/useSliderFacet.js +43 -0
- package/src/i18n/Sorani.js +60 -0
- package/src/i18n/ar_AE.js +60 -0
- package/src/i18n/bg_BG.js +60 -0
- package/src/i18n/bn_IN.js +60 -0
- package/src/i18n/ca_ES.js +60 -0
- package/src/i18n/cs_CZ.js +60 -0
- package/src/i18n/da_DK.js +60 -0
- package/src/i18n/de_DE.js +60 -0
- package/src/i18n/el_GR.js +60 -0
- package/src/i18n/en_GA.js +60 -0
- package/src/i18n/en_GB.js +60 -0
- package/src/i18n/en_US.js +70 -0
- package/src/i18n/es_ES.js +60 -0
- package/src/i18n/et_EE.js +60 -0
- package/src/i18n/eu_ES.js +60 -0
- package/src/i18n/fa_IR.js +60 -0
- package/src/i18n/fi_FI.js +60 -0
- package/src/i18n/fr_FR.js +60 -0
- package/src/i18n/gl_ES.js +60 -0
- package/src/i18n/hi_IN.js +60 -0
- package/src/i18n/hu_HU.js +60 -0
- package/src/i18n/hy_AM.js +60 -0
- package/src/i18n/id_ID.js +60 -0
- package/src/i18n/index.js +89 -0
- package/src/i18n/it_IT.js +60 -0
- package/src/i18n/ja_JP.js +60 -0
- package/src/i18n/ko_KR.js +60 -0
- package/src/i18n/lt_LT.js +60 -0
- package/src/i18n/lv_LV.js +60 -0
- package/src/i18n/nb_NO.js +60 -0
- package/src/i18n/nl_NL.js +60 -0
- package/src/i18n/pt_BR.js +60 -0
- package/src/i18n/pt_PT.js +60 -0
- package/src/i18n/ro_RO.js +60 -0
- package/src/i18n/ru_RU.js +60 -0
- package/src/i18n/sv_SE.js +60 -0
- package/src/i18n/th_TH.js +60 -0
- package/src/i18n/tr_TR.js +60 -0
- package/src/i18n/zh_Hans_CN.js +60 -0
- package/src/i18n/zh_Hant_TW.js +60 -0
- package/src/icons/NoImage.svg +1 -0
- package/src/icons/adjustments.svg +3 -0
- package/src/icons/cart.svg +3 -0
- package/src/icons/checkmark.svg +3 -0
- package/src/icons/chevron.svg +3 -0
- package/src/icons/emptyHeart.svg +3 -0
- package/src/icons/error.svg +3 -0
- package/src/icons/filledHeart.svg +3 -0
- package/src/icons/filter.svg +29 -0
- package/src/icons/gridView.svg +11 -0
- package/src/icons/info.svg +3 -0
- package/src/icons/listView.svg +5 -0
- package/src/icons/loading.svg +6 -0
- package/src/icons/plus.svg +4 -0
- package/src/icons/sort.svg +18 -0
- package/src/icons/warning.svg +3 -0
- package/src/icons/x.svg +3 -0
- package/src/index.jsx +65 -0
- package/src/queries/customerGroupCode.gql.js +10 -0
- package/src/queries/eventing/getMagentoExtensionContext.gql.js +13 -0
- package/src/queries/eventing/getPageType.gql.js +14 -0
- package/src/queries/eventing/getStorefrontContext.gql.js +27 -0
- package/src/queries/index.js +3 -0
- package/src/queries/liveSearchPlpConfigs.gql.js +30 -0
- package/src/queries/liveSearchPopoverConfigs.gql.js +28 -0
- package/src/styles/autocomplete.module.css +56 -0
- package/src/styles/index.css +1638 -0
- package/src/styles/searchBar.module.css +119 -0
- package/src/styles/tokens.css +99 -0
- package/src/targets/intercept.js +21 -0
- package/src/utils/constants.js +26 -0
- package/src/utils/decodeHtmlString.js +13 -0
- package/src/utils/dom.js +14 -0
- package/src/utils/eventing/getCookie.js +9 -0
- package/src/utils/eventing/usePageTypeFromUrl.js +26 -0
- package/src/utils/getProductImage.js +94 -0
- package/src/utils/getProductPrice.js +83 -0
- package/src/utils/getUserViewHistory.js +27 -0
- package/src/utils/handleUrlFilters.js +164 -0
- package/src/utils/htmlStringDecode.js +13 -0
- package/src/utils/modifyResults.js +164 -0
- package/src/utils/sort.js +95 -0
- package/src/utils/useIntersectionObserver.js +27 -0
- package/src/utils/validateStoreDetails.js +39 -0
- package/src/wrappers/wrapUseApp.js +28 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const SimpleProduct = {
|
|
11
|
+
product: {
|
|
12
|
+
sku: '24-WG088',
|
|
13
|
+
name: 'Sprite Foam Roller',
|
|
14
|
+
canonical_url:
|
|
15
|
+
'http://master-7rqtwti-grxawiljl6f4y.us-4.magentosite.cloud/sprite-foam-roller.html'
|
|
16
|
+
},
|
|
17
|
+
productView: {
|
|
18
|
+
__typename: 'SimpleProductView',
|
|
19
|
+
sku: '24-WG088',
|
|
20
|
+
name: 'Sprite Foam Roller',
|
|
21
|
+
url:
|
|
22
|
+
'http://master-7rqtwti-grxawiljl6f4y.us-4.magentosite.cloud/sprite-foam-roller.html',
|
|
23
|
+
urlKey: 'sprite-foam-roller',
|
|
24
|
+
images: [
|
|
25
|
+
{
|
|
26
|
+
label: 'Image',
|
|
27
|
+
url:
|
|
28
|
+
'http://master-7rqtwti-grxawiljl6f4y.us-4.magentosite.cloud/media/catalog/product/l/u/luma-foam-roller.jpg'
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
price: {
|
|
32
|
+
final: {
|
|
33
|
+
amount: {
|
|
34
|
+
value: 19.0,
|
|
35
|
+
currency: 'USD'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
regular: {
|
|
39
|
+
amount: {
|
|
40
|
+
value: 19.0,
|
|
41
|
+
currency: 'USD'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
highlights: [
|
|
47
|
+
{
|
|
48
|
+
attribute: 'name',
|
|
49
|
+
value: '<em>Sprite</em> Foam Roller',
|
|
50
|
+
matched_words: []
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const ComplexProduct = {
|
|
56
|
+
product: {
|
|
57
|
+
sku: 'MSH06',
|
|
58
|
+
name: 'Lono Yoga Short',
|
|
59
|
+
canonical_url:
|
|
60
|
+
'http://master-7rqtwti-grxawiljl6f4y.us-4.magentosite.cloud/lono-yoga-short.html'
|
|
61
|
+
},
|
|
62
|
+
productView: {
|
|
63
|
+
__typename: 'ComplexProductView',
|
|
64
|
+
sku: 'MSH06',
|
|
65
|
+
name: 'Lono Yoga Short',
|
|
66
|
+
url:
|
|
67
|
+
'http://master-7rqtwti-grxawiljl6f4y.us-4.magentosite.cloud/lono-yoga-short.html',
|
|
68
|
+
urlKey: 'lono-yoga-short',
|
|
69
|
+
images: [
|
|
70
|
+
{
|
|
71
|
+
label: '',
|
|
72
|
+
url:
|
|
73
|
+
'http://master-7rqtwti-grxawiljl6f4y.us-4.magentosite.cloud/media/catalog/product/m/s/msh06-gray_main_2.jpg'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: '',
|
|
77
|
+
url:
|
|
78
|
+
'http://master-7rqtwti-grxawiljl6f4y.us-4.magentosite.cloud/media/catalog/product/m/s/msh06-gray_alt1_2.jpg'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: '',
|
|
82
|
+
url:
|
|
83
|
+
'http://master-7rqtwti-grxawiljl6f4y.us-4.magentosite.cloud/media/catalog/product/m/s/msh06-gray_back_2.jpg'
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
priceRange: {
|
|
87
|
+
maximum: {
|
|
88
|
+
final: {
|
|
89
|
+
amount: {
|
|
90
|
+
value: 32.0,
|
|
91
|
+
currency: 'USD'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
regular: {
|
|
95
|
+
amount: {
|
|
96
|
+
value: 32.0,
|
|
97
|
+
currency: 'USD'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
minimum: {
|
|
102
|
+
final: {
|
|
103
|
+
amount: {
|
|
104
|
+
value: 32.0,
|
|
105
|
+
currency: 'USD'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
regular: {
|
|
109
|
+
amount: {
|
|
110
|
+
value: 32.0,
|
|
111
|
+
currency: 'USD'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
options: [
|
|
117
|
+
{
|
|
118
|
+
id: 'size',
|
|
119
|
+
title: 'Size',
|
|
120
|
+
values: [
|
|
121
|
+
{
|
|
122
|
+
title: '32',
|
|
123
|
+
id: 'Y29uZmlndXJhYmxlLzE4Ni8xODQ=',
|
|
124
|
+
type: 'TEXT',
|
|
125
|
+
value: '32'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
title: '33',
|
|
129
|
+
id: 'Y29uZmlndXJhYmxlLzE4Ni8xODU=',
|
|
130
|
+
type: 'TEXT',
|
|
131
|
+
value: '33'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
title: '34',
|
|
135
|
+
id: 'Y29uZmlndXJhYmxlLzE4Ni8xODY=',
|
|
136
|
+
type: 'TEXT',
|
|
137
|
+
value: '34'
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
title: '36',
|
|
141
|
+
id: 'Y29uZmlndXJhYmxlLzE4Ni8xODc=',
|
|
142
|
+
type: 'TEXT',
|
|
143
|
+
value: '36'
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: 'color',
|
|
149
|
+
title: 'Color',
|
|
150
|
+
values: [
|
|
151
|
+
{
|
|
152
|
+
title: 'Blue',
|
|
153
|
+
id: 'Y29uZmlndXJhYmxlLzkzLzU5',
|
|
154
|
+
type: 'COLOR_HEX',
|
|
155
|
+
value: '#1857f7'
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
title: 'Red',
|
|
159
|
+
id: 'Y29uZmlndXJhYmxlLzkzLzY3',
|
|
160
|
+
type: 'COLOR_HEX',
|
|
161
|
+
value: '#ff0000'
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
title: 'Gray',
|
|
165
|
+
id: 'Y29uZmlndXJhYmxlLzkzLzYx',
|
|
166
|
+
type: 'COLOR_HEX',
|
|
167
|
+
value: '#8f8f8f'
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
highlights: [
|
|
174
|
+
{
|
|
175
|
+
attribute: 'name',
|
|
176
|
+
value: 'Lono <em>Yoga</em> Short',
|
|
177
|
+
matched_words: []
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const products = [
|
|
183
|
+
SimpleProduct,
|
|
184
|
+
SimpleProduct,
|
|
185
|
+
SimpleProduct,
|
|
186
|
+
SimpleProduct,
|
|
187
|
+
SimpleProduct,
|
|
188
|
+
SimpleProduct,
|
|
189
|
+
ComplexProduct
|
|
190
|
+
];
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React, { useEffect, useState, useMemo } from 'react';
|
|
11
|
+
import './product-list.css';
|
|
12
|
+
|
|
13
|
+
import { Alert } from '../../components/Alert';
|
|
14
|
+
import { useProducts, useStore } from '../../context';
|
|
15
|
+
import { ProductItem } from '../ProductItem';
|
|
16
|
+
import { classNames } from '../../utils/dom';
|
|
17
|
+
import { sanitizeProducts } from '../../utils/modifyResults';
|
|
18
|
+
import { useResultsModifier } from '../../context/resultsModifierContext';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const ProductList = ({ products, numberOfColumns, showFilters }) => {
|
|
22
|
+
const productsCtx = useProducts();
|
|
23
|
+
const {
|
|
24
|
+
currencySymbol,
|
|
25
|
+
currencyRate,
|
|
26
|
+
setRoute,
|
|
27
|
+
refineProduct,
|
|
28
|
+
refreshCart,
|
|
29
|
+
addToCart,
|
|
30
|
+
} = productsCtx;
|
|
31
|
+
|
|
32
|
+
const [cartUpdated, setCartUpdated] = useState(false);
|
|
33
|
+
const [itemAdded, setItemAdded] = useState('');
|
|
34
|
+
const { viewType } = useProducts();
|
|
35
|
+
const [error, setError] = useState(false);
|
|
36
|
+
|
|
37
|
+
const {
|
|
38
|
+
config: { listview },
|
|
39
|
+
} = useStore();
|
|
40
|
+
|
|
41
|
+
const { baseUrl, baseUrlWithoutProtocol } = useResultsModifier();
|
|
42
|
+
|
|
43
|
+
const sanitizedProducts = useMemo(() => sanitizeProducts(products, baseUrl, baseUrlWithoutProtocol), [products]);
|
|
44
|
+
|
|
45
|
+
const className = showFilters
|
|
46
|
+
? 'ds-sdk-product-list bg-body max-w-full pl-3 pb-2xl sm:pb-24'
|
|
47
|
+
: 'ds-sdk-product-list bg-body w-full mx-auto pb-2xl sm:pb-24';
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (refreshCart) refreshCart();
|
|
51
|
+
}, [itemAdded]);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div
|
|
55
|
+
className={classNames(
|
|
56
|
+
'ds-sdk-product-list bg-body pb-2xl sm:pb-24',
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
>
|
|
60
|
+
{cartUpdated && (
|
|
61
|
+
<div className="mt-8">
|
|
62
|
+
<Alert
|
|
63
|
+
title={`You added ${itemAdded} to your shopping cart.`}
|
|
64
|
+
type="success"
|
|
65
|
+
description=""
|
|
66
|
+
onClick={() => setCartUpdated(false)}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
)}
|
|
70
|
+
{error && (
|
|
71
|
+
<div className="mt-8">
|
|
72
|
+
<Alert
|
|
73
|
+
title="Something went wrong trying to add an item to your cart."
|
|
74
|
+
type="error"
|
|
75
|
+
description=""
|
|
76
|
+
onClick={() => setError(false)}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
|
|
81
|
+
{listview && viewType === 'listview' ? (
|
|
82
|
+
<div className="w-full">
|
|
83
|
+
<div className="ds-sdk-product-list__list-view-default mt-md grid grid-cols-none pt-[15px] w-full gap-[10px]">
|
|
84
|
+
{sanitizedProducts?.map((product) => (
|
|
85
|
+
<ProductItem
|
|
86
|
+
key={product?.productView?.id}
|
|
87
|
+
item={product}
|
|
88
|
+
currencySymbol={currencySymbol}
|
|
89
|
+
currencyRate={currencyRate}
|
|
90
|
+
setRoute={setRoute}
|
|
91
|
+
refineProduct={refineProduct}
|
|
92
|
+
setCartUpdated={setCartUpdated}
|
|
93
|
+
setItemAdded={setItemAdded}
|
|
94
|
+
addToCart={addToCart}
|
|
95
|
+
setError={setError}
|
|
96
|
+
/>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
) : (
|
|
101
|
+
<div
|
|
102
|
+
style={{
|
|
103
|
+
gridTemplateColumns: `repeat(${numberOfColumns}, minmax(0, 1fr))`,
|
|
104
|
+
}}
|
|
105
|
+
className="ds-sdk-product-list__grid mt-md grid gap-y-8 gap-x-2xl xl:gap-x-8"
|
|
106
|
+
>
|
|
107
|
+
{sanitizedProducts?.map((product) => (
|
|
108
|
+
<ProductItem
|
|
109
|
+
key={product?.productView?.id}
|
|
110
|
+
item={product}
|
|
111
|
+
currencySymbol={currencySymbol}
|
|
112
|
+
currencyRate={currencyRate}
|
|
113
|
+
setRoute={setRoute}
|
|
114
|
+
refineProduct={refineProduct}
|
|
115
|
+
setCartUpdated={setCartUpdated}
|
|
116
|
+
setItemAdded={setItemAdded}
|
|
117
|
+
addToCart={addToCart}
|
|
118
|
+
setError={setError}
|
|
119
|
+
/>
|
|
120
|
+
))}
|
|
121
|
+
</div>
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export default ProductList;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { default as ProductList } from './ProductList';
|
|
11
|
+
export * from './ProductList';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* https://cssguidelin.es/#bem-like-naming */
|
|
2
|
+
.sfsdk-product-list {
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* Extra small devices (phones, 600px and down) */
|
|
6
|
+
/* @media only screen and (max-width: 600px) { } */
|
|
7
|
+
|
|
8
|
+
/* Small devices (portrait tablets and large phones, 600px and up) */
|
|
9
|
+
/* @media only screen and (min-width: 600px) { } */
|
|
10
|
+
|
|
11
|
+
/* Medium devices (landscape tablets, 768px and up) */
|
|
12
|
+
/* @media only screen and (min-width: 768px) { } */
|
|
13
|
+
|
|
14
|
+
/* Large devices (laptops/desktops, 992px and up) */
|
|
15
|
+
/* @media only screen and (min-width: 992px) { } */
|
|
16
|
+
|
|
17
|
+
/* Extra large devices (large laptops and desktops, 1200px and up) */
|
|
18
|
+
/* @media only screen and (min-width: 1200px) { } */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
|
|
12
|
+
export const SearchBar = ({
|
|
13
|
+
phrase,
|
|
14
|
+
onKeyPress,
|
|
15
|
+
placeholder,
|
|
16
|
+
onClear, // included for completeness, though unused in this component
|
|
17
|
+
...rest
|
|
18
|
+
}) => {
|
|
19
|
+
return (
|
|
20
|
+
<div className="relative ds-sdk-search-bar">
|
|
21
|
+
<input
|
|
22
|
+
id="search"
|
|
23
|
+
type="text"
|
|
24
|
+
value={phrase}
|
|
25
|
+
onKeyPress={onKeyPress}
|
|
26
|
+
className="border border-gray-300 text-gray-800 text-sm block-display p-xs pr-lg ds-sdk-search-bar__input"
|
|
27
|
+
placeholder={placeholder}
|
|
28
|
+
autoComplete="off"
|
|
29
|
+
{...rest}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export * from './SearchBar';
|
|
11
|
+
export { SearchBar as default } from './SearchBar';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
width: 250px;
|
|
3
|
+
margin: 10px auto;
|
|
4
|
+
box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
|
|
5
|
+
padding: 20px;
|
|
6
|
+
}
|
|
7
|
+
@keyframes placeholderShimmer {
|
|
8
|
+
0% {
|
|
9
|
+
background-position: -468px 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
100% {
|
|
13
|
+
background-position: 468px 0;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.shimmer-animation {
|
|
18
|
+
background-color: #f6f7f8;
|
|
19
|
+
background-image: linear-gradient(
|
|
20
|
+
to right,
|
|
21
|
+
#f6f7f8 0%,
|
|
22
|
+
#edeef1 20%,
|
|
23
|
+
#f6f7f8 40%,
|
|
24
|
+
#f6f7f8 100%
|
|
25
|
+
);
|
|
26
|
+
background-repeat: no-repeat;
|
|
27
|
+
background-size: 800px 104px;
|
|
28
|
+
animation-duration: 1s;
|
|
29
|
+
animation-fill-mode: forwards;
|
|
30
|
+
animation-iteration-count: infinite;
|
|
31
|
+
animation-name: placeholderShimmer;
|
|
32
|
+
animation-timing-function: linear;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.loader {
|
|
36
|
+
&-shimmer {
|
|
37
|
+
&-banner {
|
|
38
|
+
height: 22rem;
|
|
39
|
+
background-size: 800px 22rem;
|
|
40
|
+
border-radius: 5px;
|
|
41
|
+
margin-bottom: 12px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&-header {
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
margin-bottom: 5px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&-title {
|
|
51
|
+
height: 25px;
|
|
52
|
+
flex: 0 0 auto;
|
|
53
|
+
width: 120px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&-rating {
|
|
57
|
+
height: 25px;
|
|
58
|
+
flex: 0 0 auto;
|
|
59
|
+
width: 70px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&-list {
|
|
63
|
+
height: 20px;
|
|
64
|
+
width: 190px;
|
|
65
|
+
margin-bottom: 5px;
|
|
66
|
+
|
|
67
|
+
&:last-child {
|
|
68
|
+
margin-bottom: 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&-info {
|
|
73
|
+
height: 20px;
|
|
74
|
+
width: 220px;
|
|
75
|
+
margin-bottom: 5px;
|
|
76
|
+
|
|
77
|
+
&:last-child {
|
|
78
|
+
margin-bottom: 0;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { useSensor } from '../../context'; // Adjust relative path if needed
|
|
12
|
+
|
|
13
|
+
import ButtonShimmer from '../ButtonShimmer';
|
|
14
|
+
import FacetsShimmer from '../FacetsShimmer';
|
|
15
|
+
import ProductCardShimmer from '../ProductCardShimmer';
|
|
16
|
+
|
|
17
|
+
const Shimmer = () => {
|
|
18
|
+
const productCardArray = Array.from({ length: 8 });
|
|
19
|
+
const facetsArray = Array.from({ length: 4 });
|
|
20
|
+
const { screenSize } = useSensor();
|
|
21
|
+
const numberOfColumns = screenSize.columns;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="ds-widgets bg-body py-2">
|
|
25
|
+
<div className="flex">
|
|
26
|
+
<div className="sm:flex ds-widgets-_actions relative max-w-[21rem] w-full h-full px-2 flex-col overflow-y-auto">
|
|
27
|
+
<div className="ds-widgets_actions_header flex justify-between items-center mb-md" />
|
|
28
|
+
<div className="flex pb-4 w-full h-full">
|
|
29
|
+
<div className="ds-sdk-filter-button-desktop">
|
|
30
|
+
<button className="flex items-center bg-gray-100 ring-black ring-opacity-5 rounded-md p-sm text-sm h-[32px]">
|
|
31
|
+
<ButtonShimmer />
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="ds-plp-facets flex flex-col">
|
|
36
|
+
<form className="ds-plp-facets__list border-t border-gray-200">
|
|
37
|
+
{facetsArray.map((_, index) => (
|
|
38
|
+
<FacetsShimmer key={index} />
|
|
39
|
+
))}
|
|
40
|
+
</form>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<div className="ds-widgets_results flex flex-col items-center pt-16 w-full h-full">
|
|
44
|
+
<div className="flex flex-col max-w-5xl lg:max-w-7xl ml-auto w-full h-full">
|
|
45
|
+
<div className="flex justify-end mb-[1px]">
|
|
46
|
+
<ButtonShimmer />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div
|
|
50
|
+
className="ds-sdk-product-list__grid mt-md grid-cols-1 gap-y-8 gap-x-md sm:grid-cols-2 md:grid-cols-3 xl:gap-x-4 pl-8"
|
|
51
|
+
style={{
|
|
52
|
+
display: 'grid',
|
|
53
|
+
gridTemplateColumns: `repeat(${numberOfColumns}, minmax(0, 1fr))`,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{productCardArray.map((_, index) => (
|
|
57
|
+
<ProductCardShimmer key={index} />
|
|
58
|
+
))}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default Shimmer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe
|
|
3
|
+
All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export * from './Shimmer';
|
|
11
|
+
export { default } from './Shimmer';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.slider-container {
|
|
2
|
+
margin: 0 auto;
|
|
3
|
+
position: relative;
|
|
4
|
+
padding-top: 20px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.range-slider {
|
|
8
|
+
appearance: none;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 10px;
|
|
11
|
+
border-radius: 5px;
|
|
12
|
+
background: linear-gradient(to right, #dddddd 0%, #cccccc 100%);
|
|
13
|
+
outline: none;
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 50%;
|
|
16
|
+
transform: translateY(-50%);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.range-slider::-webkit-slider-thumb {
|
|
20
|
+
appearance: none;
|
|
21
|
+
width: 20px;
|
|
22
|
+
height: 20px;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
background: #ffffff;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.range-slider::-moz-range-thumb {
|
|
29
|
+
appearance: none;
|
|
30
|
+
width: 20px;
|
|
31
|
+
height: 20px;
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
background: #ffffff;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.selected-price {
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: -5px;
|
|
40
|
+
left: 50%;
|
|
41
|
+
transform: translateX(-50%);
|
|
42
|
+
padding: 5px 10px;
|
|
43
|
+
border-radius: 5px;
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
color: #333;
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.price-range-display {
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
margin-top: 0px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.min-price,
|
|
57
|
+
.max-price {
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
color: #333;
|
|
61
|
+
}
|