@riosst100/pwa-marketplace 1.7.0 → 1.7.2
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 +2 -1
- package/src/componentOverrideMapping.js +4 -0
- package/src/components/CollectibleGameSets/collectibleGameSets.js +0 -4
- package/src/components/FilterTop/filterTop.js +0 -2
- package/src/components/FilterTopBackup/CustomFilters/customFilters.js +0 -1
- package/src/components/ProductLabel/index.js +13 -5
- package/src/components/ProductListTab/productListTab.js +1 -3
- package/src/components/RelatedProduct/relatedProduct.js +1 -1
- package/src/components/ShopBy/shopBy copy.js +0 -1
- package/src/components/ShopBy/shopBy.js +0 -1
- package/src/components/ShopBySets/shopBySets.js +0 -3
- package/src/components/SportCardsSets/index.js +2 -0
- package/src/components/SportCardsSets/sportCardsSets.js +372 -0
- package/src/components/SportCardsSets/sportCardsSets.module.css +76 -0
- package/src/components/SportCardsSets/sportCardsSets.shimmer.js +50 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/__fixtures__/apolloMocks.js +33 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/carousel.gql.ce.js +16 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/carousel.gql.ee.js +17 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/carousel.js +38 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/index.js +1 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/useCarousel.js +25 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/configAggregator.js +26 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/index.js +1 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/products.js +369 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Products/products.module.css +0 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/banner.module.css +103 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/configAggregator.js +17 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/index.js +2 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/slider.js +221 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/slider.module.css +231 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/slider.shimmer.js +126 -0
- package/src/overwrites/pagebuilder/lib/ContentTypes/Slider/slider.shimmer.module.css +5 -0
- package/src/overwrites/pagebuilder/lib/utils.js +224 -0
- package/src/overwrites/peregrine/lib/talons/FilterSidebar/useFilterSidebar.js +1 -1
- package/src/overwrites/peregrine/lib/talons/ProductFullDetail/useProductFullDetail.js +3 -1
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryFragments.gql.js +3 -0
- package/src/overwrites/peregrine/lib/talons/RootComponents/Product/productDetailFragment.gql.js +39 -0
- package/src/overwrites/venia-ui/lib/RootComponents/CMS/cms.js +73 -0
- package/src/overwrites/venia-ui/lib/RootComponents/CMS/cms.module.css +25 -0
- package/src/overwrites/venia-ui/lib/RootComponents/CMS/cms.shimmer.js +18 -0
- package/src/overwrites/venia-ui/lib/RootComponents/CMS/index.js +7 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +12 -1
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -13
- package/src/overwrites/venia-ui/lib/components/App/app.js +131 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +1 -1
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +1 -1
- package/src/overwrites/venia-ui/lib/components/Gallery/item.js +9 -2
- package/src/overwrites/venia-ui/lib/components/Gallery/item.module.css +1 -1
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/auctionDetail.js +176 -138
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/preOrderDetail.js +1 -4
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +1 -1
- package/src/overwrites/venia-ui/lib/components/RichContent/richContent.module.css +3 -3
- package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.js +0 -1
- package/src/overwrites/venia-ui/lib/index.module.css +137 -0
- package/src/overwrites/venia-ui/lib/tokens.module.css +167 -0
- package/src/talons/CollectibleGameSets/collectibleGameSets.gql.js +15 -1
- package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +0 -11
- package/src/talons/FilterTop/useFilterTop.js +0 -2
- package/src/talons/ShopBy/useShopBy.js +0 -22
- package/src/talons/SportCardsSets/sportCardsSets.gql.js +46 -0
- package/src/talons/SportCardsSets/useSportCardsSets.js +170 -0
- package/src/talons/SubCategoryPage/useSubCategoryPage.js +0 -3
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
4
|
+
|
|
5
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
6
|
+
import defaultClasses from './sportCardsSets.module.css';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
9
|
+
|
|
10
|
+
const SportCardsSets = props => {
|
|
11
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'><Shimmer width="25%" height="6vh" /></h1>
|
|
16
|
+
<div className='border border-gray-100 px-6'>
|
|
17
|
+
<center>
|
|
18
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
19
|
+
<Shimmer width="95%" height="6vh" />
|
|
20
|
+
</section>
|
|
21
|
+
</center>
|
|
22
|
+
<Divider className="mb-5 px-4" />
|
|
23
|
+
<section className='singles-container'>
|
|
24
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
25
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
26
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
27
|
+
</div>
|
|
28
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
29
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
30
|
+
</div>
|
|
31
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
32
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
33
|
+
</div>
|
|
34
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
35
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
36
|
+
</div>
|
|
37
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
38
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
39
|
+
</div>
|
|
40
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
41
|
+
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
45
|
+
</div>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default SportCardsSets;
|
package/src/overwrites/pagebuilder/lib/ContentTypes/Products/Carousel/__fixtures__/apolloMocks.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import acOperations from '../carousel.gql.ee';
|
|
2
|
+
import mosOperations from '../carousel.gql.ce';
|
|
3
|
+
|
|
4
|
+
export const mockGetStoreConfigAC = {
|
|
5
|
+
request: {
|
|
6
|
+
query: acOperations.getStoreConfigQuery
|
|
7
|
+
},
|
|
8
|
+
result: {
|
|
9
|
+
data: {
|
|
10
|
+
storeConfig: {
|
|
11
|
+
store_code: 'default',
|
|
12
|
+
magento_wishlist_general_is_enabled: '1',
|
|
13
|
+
enable_multiple_wishlists: '1',
|
|
14
|
+
product_url_suffix: '.html'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const mockGetStoreConfigMOS = {
|
|
21
|
+
request: {
|
|
22
|
+
query: mosOperations.getStoreConfigQuery
|
|
23
|
+
},
|
|
24
|
+
result: {
|
|
25
|
+
data: {
|
|
26
|
+
storeConfig: {
|
|
27
|
+
store_code: 'default',
|
|
28
|
+
magento_wishlist_general_is_enabled: '1',
|
|
29
|
+
product_url_suffix: '.html'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_STORE_CONFIG = gql`
|
|
4
|
+
query GetStoreConfigForCarouselMOS {
|
|
5
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
6
|
+
storeConfig {
|
|
7
|
+
store_code
|
|
8
|
+
product_url_suffix
|
|
9
|
+
magento_wishlist_general_is_enabled
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
getStoreConfigQuery: GET_STORE_CONFIG
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_STORE_CONFIG = gql`
|
|
4
|
+
query GetStoreConfigForCarouselAC {
|
|
5
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
6
|
+
storeConfig {
|
|
7
|
+
store_code
|
|
8
|
+
product_url_suffix
|
|
9
|
+
magento_wishlist_general_is_enabled
|
|
10
|
+
enable_multiple_wishlists
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
getStoreConfigQuery: GET_STORE_CONFIG
|
|
17
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Slider from "react-slick";
|
|
3
|
+
import GalleryItem from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Gallery/item';
|
|
4
|
+
import { useCarousel } from './useCarousel';
|
|
5
|
+
|
|
6
|
+
const Carousel = props => {
|
|
7
|
+
const { settings, items } = props;
|
|
8
|
+
const { storeConfig } = useCarousel();
|
|
9
|
+
|
|
10
|
+
const galleryItems = items.map((item, index) => {
|
|
11
|
+
return (
|
|
12
|
+
<GalleryItem key={index} item={item} storeConfig={storeConfig} rootClassName="px-2 block product-item max-w-[240px]" />
|
|
13
|
+
);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<Slider {...settings} className='product-carousel -mx-2'>
|
|
19
|
+
{galleryItems}
|
|
20
|
+
</Slider>
|
|
21
|
+
<style global jsx>
|
|
22
|
+
{`
|
|
23
|
+
.product-carousel .slick-slide a {
|
|
24
|
+
text-decoration: none !important;
|
|
25
|
+
}
|
|
26
|
+
// article[class*="cms-root"] {
|
|
27
|
+
// padding: 0;
|
|
28
|
+
// }
|
|
29
|
+
.product-carousel .item-product img {
|
|
30
|
+
margin: 0 !important;
|
|
31
|
+
}
|
|
32
|
+
`}
|
|
33
|
+
</style>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default Carousel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './carousel';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
import { useCustomerWishlistSkus } from '@magento/peregrine/lib/hooks/useCustomerWishlistSkus/useCustomerWishlistSkus';
|
|
4
|
+
|
|
5
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
6
|
+
import defaultOperations from './carousel.gql';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This is a duplicate of @magento/peregrine/lib/talons/Gallery/useGallery.js
|
|
10
|
+
*/
|
|
11
|
+
export const useCarousel = (props = {}) => {
|
|
12
|
+
const operations = mergeOperations(defaultOperations, props.operations);
|
|
13
|
+
|
|
14
|
+
useCustomerWishlistSkus();
|
|
15
|
+
|
|
16
|
+
const { data: storeConfigData } = useQuery(operations.getStoreConfigQuery, {
|
|
17
|
+
fetchPolicy: 'cache-and-network'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const storeConfig = storeConfigData ? storeConfigData.storeConfig : null;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
storeConfig
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getAdvanced } from '../../utils';
|
|
2
|
+
|
|
3
|
+
export default (node, props) => {
|
|
4
|
+
const forms = node.querySelectorAll(
|
|
5
|
+
'.product-item-details > .product-item-name > a.product-item-link'
|
|
6
|
+
);
|
|
7
|
+
let carouselConfig = {};
|
|
8
|
+
|
|
9
|
+
if (props.appearance === 'carousel') {
|
|
10
|
+
carouselConfig = {
|
|
11
|
+
autoplay: node.getAttribute('data-autoplay') === 'true',
|
|
12
|
+
autoplaySpeed: parseInt(node.getAttribute('data-autoplay-speed')),
|
|
13
|
+
infinite: node.getAttribute('data-infinite-loop') === 'true',
|
|
14
|
+
arrows: node.getAttribute('data-show-arrows') === 'true',
|
|
15
|
+
dots: node.getAttribute('data-show-dots') === 'true',
|
|
16
|
+
carouselMode: node.getAttribute('data-carousel-mode'),
|
|
17
|
+
centerPadding: node.getAttribute('data-center-padding')
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
pathNames: [...forms].map(form => form.getAttribute('href')),
|
|
23
|
+
...carouselConfig,
|
|
24
|
+
...getAdvanced(node)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './products';
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { gql, useQuery } from '@apollo/client';
|
|
3
|
+
import { arrayOf, bool, number, oneOf, shape, string } from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
import Gallery from '@magento/venia-ui/lib/components/Gallery';
|
|
7
|
+
import Carousel from './Carousel/carousel';
|
|
8
|
+
import defaultClasses from './products.module.css';
|
|
9
|
+
import { ArrowLeft2, ArrowRight2 } from 'iconsax-react';
|
|
10
|
+
import cn from 'classnames';
|
|
11
|
+
import { primary900 } from '@riosst100/pwa-marketplace/src/theme/vars';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Sort products based on the original order
|
|
15
|
+
*
|
|
16
|
+
* @param {Array} urlKeys
|
|
17
|
+
* @param {Array} products
|
|
18
|
+
* @returns {Array}
|
|
19
|
+
*/
|
|
20
|
+
const restoreSortOrder = (urlKeys, products) => {
|
|
21
|
+
const productsByOriginalOrder = new Map();
|
|
22
|
+
products.forEach(product => {
|
|
23
|
+
productsByOriginalOrder.set(product.url_key, product);
|
|
24
|
+
});
|
|
25
|
+
return urlKeys
|
|
26
|
+
.map(urlKey => productsByOriginalOrder.get(urlKey))
|
|
27
|
+
.filter(Boolean);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Custom Arrow
|
|
31
|
+
const CustomArrow = (props) => {
|
|
32
|
+
const { isNext = true, onClick, className } = props;
|
|
33
|
+
return (
|
|
34
|
+
<span
|
|
35
|
+
className={cn(
|
|
36
|
+
className,
|
|
37
|
+
'custom_arrow rounded-full w-10 h-10 p-2.5 bg-white hover_!bg-white z-[1] !border !border-solid !border-gray-100 before_hidden',
|
|
38
|
+
isNext ? 'right-2 lg_right-4' : 'left-2 lg_left-4',
|
|
39
|
+
)}
|
|
40
|
+
onClick={onClick}
|
|
41
|
+
>
|
|
42
|
+
{isNext ? (
|
|
43
|
+
<ArrowRight2 className='' size="20" color={primary900} />
|
|
44
|
+
) : (
|
|
45
|
+
<ArrowLeft2 size="20" color={primary900} />
|
|
46
|
+
)}
|
|
47
|
+
</span>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Page Builder Products component.
|
|
53
|
+
*
|
|
54
|
+
* This component is part of the Page Builder / PWA integration. It can be consumed without Page Builder.
|
|
55
|
+
*
|
|
56
|
+
* @typedef Products
|
|
57
|
+
* @kind functional component
|
|
58
|
+
*
|
|
59
|
+
* @param {props} props React component props
|
|
60
|
+
*
|
|
61
|
+
* @returns {React.Element} A React component that displays a Products based on a number of products
|
|
62
|
+
*/
|
|
63
|
+
const Products = props => {
|
|
64
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
65
|
+
const {
|
|
66
|
+
appearance,
|
|
67
|
+
autoplay,
|
|
68
|
+
autoplaySpeed,
|
|
69
|
+
infinite,
|
|
70
|
+
arrows,
|
|
71
|
+
dots,
|
|
72
|
+
draggable = false,
|
|
73
|
+
carouselMode,
|
|
74
|
+
centerPadding,
|
|
75
|
+
pathNames = [],
|
|
76
|
+
textAlign,
|
|
77
|
+
border,
|
|
78
|
+
borderColor,
|
|
79
|
+
borderWidth,
|
|
80
|
+
borderRadius,
|
|
81
|
+
marginTop,
|
|
82
|
+
marginRight,
|
|
83
|
+
marginBottom,
|
|
84
|
+
marginLeft,
|
|
85
|
+
paddingTop,
|
|
86
|
+
paddingRight,
|
|
87
|
+
paddingBottom,
|
|
88
|
+
paddingLeft,
|
|
89
|
+
cssClasses = [],
|
|
90
|
+
slidesToShow = 5,
|
|
91
|
+
slidesToShowMedium = 3,
|
|
92
|
+
slidesToShowSmall = 2,
|
|
93
|
+
slidesToShowSmallCenterMode = 1
|
|
94
|
+
} = props;
|
|
95
|
+
|
|
96
|
+
const dynamicStyles = {
|
|
97
|
+
textAlign,
|
|
98
|
+
border,
|
|
99
|
+
borderColor,
|
|
100
|
+
borderWidth,
|
|
101
|
+
borderRadius,
|
|
102
|
+
marginTop,
|
|
103
|
+
marginRight,
|
|
104
|
+
marginBottom,
|
|
105
|
+
marginLeft,
|
|
106
|
+
paddingTop,
|
|
107
|
+
paddingRight,
|
|
108
|
+
paddingBottom,
|
|
109
|
+
paddingLeft
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const { data: storeConfigData } = useQuery(GET_STORE_CONFIG_DATA, {
|
|
113
|
+
fetchPolicy: 'cache-and-network',
|
|
114
|
+
nextFetchPolicy: 'cache-first'
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const productUrlSuffix = useMemo(() => {
|
|
118
|
+
if (storeConfigData) {
|
|
119
|
+
return storeConfigData.storeConfig.product_url_suffix;
|
|
120
|
+
}
|
|
121
|
+
}, [storeConfigData]);
|
|
122
|
+
|
|
123
|
+
const urlKeys = pathNames.map(pathName => {
|
|
124
|
+
const slug = pathName.split('/').pop();
|
|
125
|
+
return productUrlSuffix ? slug.replace(productUrlSuffix, '') : slug;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const { loading, error, data } = useQuery(GET_PRODUCTS_BY_URL_KEY, {
|
|
129
|
+
variables: { url_keys: urlKeys, pageSize: urlKeys.length },
|
|
130
|
+
fetchPolicy: 'cache-and-network',
|
|
131
|
+
nextFetchPolicy: 'cache-first'
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (loading) return null;
|
|
135
|
+
|
|
136
|
+
if (error || data.products.items.length === 0) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const items = restoreSortOrder(urlKeys, data.products.items);
|
|
141
|
+
|
|
142
|
+
if (appearance === 'carousel') {
|
|
143
|
+
//Settings conditions was made due to react-slick issues
|
|
144
|
+
const carouselCenterMode =
|
|
145
|
+
carouselMode === 'continuous' && items.length > slidesToShow;
|
|
146
|
+
const carouselSmallCenterMode =
|
|
147
|
+
carouselMode === 'continuous' &&
|
|
148
|
+
items.length > slidesToShowSmallCenterMode;
|
|
149
|
+
const carouselSettings = {
|
|
150
|
+
slidesToShow: items.length > 5 ? slidesToShow : items.length,
|
|
151
|
+
slidesToScroll: 1,//slidesToShow,
|
|
152
|
+
draggable,
|
|
153
|
+
nextArrow: <CustomArrow />,
|
|
154
|
+
prevArrow: <CustomArrow isNext={false} />,
|
|
155
|
+
autoplay,
|
|
156
|
+
autoplaySpeed,
|
|
157
|
+
arrows: items.length > 5 ? arrows : false,
|
|
158
|
+
dots,
|
|
159
|
+
centerMode: carouselCenterMode,
|
|
160
|
+
adaptiveHeight: true,
|
|
161
|
+
responsive: [
|
|
162
|
+
// {
|
|
163
|
+
// breakpoint: 640,
|
|
164
|
+
// settings: {
|
|
165
|
+
// slidesToShow: carouselSmallCenterMode
|
|
166
|
+
// ? slidesToShowSmallCenterMode
|
|
167
|
+
// : slidesToShowSmall,
|
|
168
|
+
// slidesToScroll: carouselSmallCenterMode
|
|
169
|
+
// ? slidesToShowSmallCenterMode
|
|
170
|
+
// : slidesToShowSmall,
|
|
171
|
+
// centerMode: carouselSmallCenterMode,
|
|
172
|
+
// ...(carouselSmallCenterMode && { centerPadding }),
|
|
173
|
+
// ...{
|
|
174
|
+
// infinite:
|
|
175
|
+
// items.length > slidesToShowSmall && infinite
|
|
176
|
+
// }
|
|
177
|
+
// }
|
|
178
|
+
// },
|
|
179
|
+
// {
|
|
180
|
+
// breakpoint: 960,
|
|
181
|
+
// settings: {
|
|
182
|
+
// slidesToShow: slidesToShowSmall + 1,
|
|
183
|
+
// slidesToScroll: slidesToShowSmall + 1
|
|
184
|
+
// }
|
|
185
|
+
// },
|
|
186
|
+
{
|
|
187
|
+
breakpoint: 1023,
|
|
188
|
+
settings: {
|
|
189
|
+
slidesToShow: slidesToShowMedium,
|
|
190
|
+
slidesToScroll: 1
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
breakpoint: 576,
|
|
195
|
+
settings: {
|
|
196
|
+
slidesToShow: slidesToShowSmall,
|
|
197
|
+
slidesToScroll: 1
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
...(carouselCenterMode && { centerPadding }),
|
|
202
|
+
infinite: items.length > 5 ? infinite : false,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const centerModeClass = carouselCenterMode ? classes.centerMode : null;
|
|
206
|
+
const centerModeSmallClass = carouselSmallCenterMode
|
|
207
|
+
? classes.centerModeSmall
|
|
208
|
+
: null;
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
<div
|
|
212
|
+
style={dynamicStyles}
|
|
213
|
+
className={[
|
|
214
|
+
classes.carousel,
|
|
215
|
+
...cssClasses,
|
|
216
|
+
centerModeClass,
|
|
217
|
+
centerModeSmallClass
|
|
218
|
+
].join(' ')}
|
|
219
|
+
>
|
|
220
|
+
<Carousel settings={carouselSettings} items={items} />
|
|
221
|
+
</div>
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<div
|
|
227
|
+
style={dynamicStyles}
|
|
228
|
+
className={[classes.root, ...cssClasses].join(' ')}
|
|
229
|
+
>
|
|
230
|
+
<Gallery items={items} classes={{ items: classes.galleryItems }} />
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Props for {@link Products}
|
|
237
|
+
*
|
|
238
|
+
* @typedef props
|
|
239
|
+
*
|
|
240
|
+
* @property {Object} classes An object containing the class names for the Products
|
|
241
|
+
* @property {String} classes.root CSS class for products
|
|
242
|
+
* @property {String} classes.carousel CSS class for products carousel appearance
|
|
243
|
+
* @property {String} classes.centerMode CSS class for products carousel appearance with center mode
|
|
244
|
+
* @property {String} classes.centerModeSmall CSS class for products carousel appearance with center mode on small screen
|
|
245
|
+
* @property {String} classes.galleryItems CSS class to modify child gallery items
|
|
246
|
+
* @property {String} classes.error CSS class for displaying fetch errors
|
|
247
|
+
* @property {String} appearance Sets products appearance
|
|
248
|
+
* @property {Boolean} autoplay Whether the carousel should autoplay
|
|
249
|
+
* @property {Number} autoplaySpeed The speed at which the autoplay should move the slide on
|
|
250
|
+
* @property {Boolean} infinite Whether to infinitely scroll the carousel
|
|
251
|
+
* @property {Boolean} arrows Whether to show arrows on the slide for navigation
|
|
252
|
+
* @property {Boolean} dots Whether to show navigation dots at the bottom of the carousel
|
|
253
|
+
* @property {Boolean} draggable Enable scrollable via dragging on desktop
|
|
254
|
+
* @property {String} carouselMode Carousel mode
|
|
255
|
+
* @property {String} centerPadding Horizontal padding in centerMode
|
|
256
|
+
* @property {Array} pathNames List of Url path names to load into product list
|
|
257
|
+
* @property {String} textAlign Alignment of content within the products list
|
|
258
|
+
* @property {String} border CSS border property
|
|
259
|
+
* @property {String} borderColor CSS border color property
|
|
260
|
+
* @property {String} borderWidth CSS border width property
|
|
261
|
+
* @property {String} borderRadius CSS border radius property
|
|
262
|
+
* @property {String} marginTop CSS margin top property
|
|
263
|
+
* @property {String} marginRight CSS margin right property
|
|
264
|
+
* @property {String} marginBottom CSS margin bottom property
|
|
265
|
+
* @property {String} marginLeft CSS margin left property
|
|
266
|
+
* @property {String} paddingTop CSS padding top property
|
|
267
|
+
* @property {String} paddingRight CSS padding right property
|
|
268
|
+
* @property {String} paddingBottom CSS padding bottom property
|
|
269
|
+
* @property {String} paddingLeft CSS padding left property
|
|
270
|
+
* @property {Array} cssClasses List of CSS classes to be applied to the component
|
|
271
|
+
* @property {Number} slidesToShow # of slides to show at a time
|
|
272
|
+
* @property {Number} slidesToShowMedium # of slides to show at a time on medium sized screens
|
|
273
|
+
* @property {Number} slidesToShowSmall # of slides to show at a time on small screen
|
|
274
|
+
* @property {Number} slidesToShowSmallCenterMode # of slides to show at a time on small screen in centerMode
|
|
275
|
+
*/
|
|
276
|
+
Products.propTypes = {
|
|
277
|
+
classes: shape({
|
|
278
|
+
root: string,
|
|
279
|
+
carousel: string,
|
|
280
|
+
centerMode: string,
|
|
281
|
+
centerModeSmall: string,
|
|
282
|
+
galleryItems: string,
|
|
283
|
+
error: string
|
|
284
|
+
}),
|
|
285
|
+
appearance: oneOf(['grid', 'carousel']),
|
|
286
|
+
autoplay: bool,
|
|
287
|
+
autoplaySpeed: number,
|
|
288
|
+
infinite: bool,
|
|
289
|
+
arrows: bool,
|
|
290
|
+
dots: bool,
|
|
291
|
+
draggable: bool,
|
|
292
|
+
carouselMode: oneOf(['default', 'continuous']),
|
|
293
|
+
centerPadding: string,
|
|
294
|
+
pathNames: arrayOf(string),
|
|
295
|
+
textAlign: string,
|
|
296
|
+
border: string,
|
|
297
|
+
borderColor: string,
|
|
298
|
+
borderWidth: string,
|
|
299
|
+
borderRadius: string,
|
|
300
|
+
marginTop: string,
|
|
301
|
+
marginRight: string,
|
|
302
|
+
marginBottom: string,
|
|
303
|
+
marginLeft: string,
|
|
304
|
+
paddingTop: string,
|
|
305
|
+
paddingRight: string,
|
|
306
|
+
paddingBottom: string,
|
|
307
|
+
paddingLeft: string,
|
|
308
|
+
cssClasses: arrayOf(string),
|
|
309
|
+
slidesToShow: number,
|
|
310
|
+
slidesToShowMedium: number,
|
|
311
|
+
slidesToShowSmall: number,
|
|
312
|
+
slidesToShowSmallCenterMode: number
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
export default Products;
|
|
316
|
+
|
|
317
|
+
export const GET_PRODUCTS_BY_URL_KEY = gql`
|
|
318
|
+
query getProductsByUrlKey($url_keys: [String], $pageSize: Int!) {
|
|
319
|
+
products(filter: { url_key: { in: $url_keys } }, pageSize: $pageSize) {
|
|
320
|
+
items {
|
|
321
|
+
id
|
|
322
|
+
uid
|
|
323
|
+
name
|
|
324
|
+
price_range {
|
|
325
|
+
maximum_price {
|
|
326
|
+
final_price {
|
|
327
|
+
currency
|
|
328
|
+
value
|
|
329
|
+
}
|
|
330
|
+
regular_price {
|
|
331
|
+
currency
|
|
332
|
+
value
|
|
333
|
+
}
|
|
334
|
+
discount {
|
|
335
|
+
amount_off
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
sku
|
|
340
|
+
small_image {
|
|
341
|
+
url
|
|
342
|
+
}
|
|
343
|
+
stock_status
|
|
344
|
+
__typename
|
|
345
|
+
url_key
|
|
346
|
+
}
|
|
347
|
+
total_count
|
|
348
|
+
filters {
|
|
349
|
+
name
|
|
350
|
+
filter_items_count
|
|
351
|
+
request_var
|
|
352
|
+
filter_items {
|
|
353
|
+
label
|
|
354
|
+
value_string
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
`;
|
|
360
|
+
|
|
361
|
+
export const GET_STORE_CONFIG_DATA = gql`
|
|
362
|
+
query getStoreConfigData {
|
|
363
|
+
# eslint-disable-next-line @graphql-eslint/require-id-when-available
|
|
364
|
+
storeConfig {
|
|
365
|
+
store_code
|
|
366
|
+
product_url_suffix
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
`;
|
|
File without changes
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
}
|
|
3
|
+
a.link {
|
|
4
|
+
text-decoration: none;
|
|
5
|
+
}
|
|
6
|
+
.wrapper {
|
|
7
|
+
background-clip: padding-box;
|
|
8
|
+
border-radius: inherit;
|
|
9
|
+
overflow-wrap: break-word;
|
|
10
|
+
word-wrap: break-word;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
.overlay {
|
|
14
|
+
padding: 30px;
|
|
15
|
+
transition: background-color 500ms ease;
|
|
16
|
+
align-items: center;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.videoOverlay {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
right: 0;
|
|
28
|
+
z-index: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.viewportElement {
|
|
32
|
+
height: 100%;
|
|
33
|
+
width: 1px;
|
|
34
|
+
position: absolute;
|
|
35
|
+
left: var(--leftViewportElement);
|
|
36
|
+
top: 0;
|
|
37
|
+
z-index: -100;
|
|
38
|
+
-webkit-transform: translate3d(0, 0, 0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.content {
|
|
42
|
+
min-height: 50px;
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
.button {
|
|
46
|
+
margin: 20px 0 0 0;
|
|
47
|
+
max-width: 100%;
|
|
48
|
+
text-align: inherit;
|
|
49
|
+
transition: opacity 500ms ease;
|
|
50
|
+
word-break: break-word;
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
.root:hover .buttonHover {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
.buttonHover {
|
|
57
|
+
composes: button;
|
|
58
|
+
opacity: 0;
|
|
59
|
+
}
|
|
60
|
+
.posterOverlay {
|
|
61
|
+
composes: overlay;
|
|
62
|
+
align-content: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
}
|
|
65
|
+
.posterOverlayHover {
|
|
66
|
+
composes: posterOverlay;
|
|
67
|
+
background-color: transparent !important;
|
|
68
|
+
}
|
|
69
|
+
.collageLeftOverlay {
|
|
70
|
+
composes: overlay;
|
|
71
|
+
margin-right: auto;
|
|
72
|
+
max-width: 540px;
|
|
73
|
+
}
|
|
74
|
+
.collageLeftOverlayHover {
|
|
75
|
+
composes: collageLeftOverlay;
|
|
76
|
+
background-color: transparent !important;
|
|
77
|
+
}
|
|
78
|
+
.collageCenteredOverlay {
|
|
79
|
+
composes: overlay;
|
|
80
|
+
margin-right: auto;
|
|
81
|
+
margin-left: auto;
|
|
82
|
+
max-width: 540px;
|
|
83
|
+
}
|
|
84
|
+
.collageCenteredOverlayHover {
|
|
85
|
+
composes: collageCenteredOverlay;
|
|
86
|
+
background-color: transparent !important;
|
|
87
|
+
}
|
|
88
|
+
.collageRightOverlay {
|
|
89
|
+
composes: overlay;
|
|
90
|
+
margin-left: auto;
|
|
91
|
+
max-width: 540px;
|
|
92
|
+
}
|
|
93
|
+
.collageRightOverlayHover {
|
|
94
|
+
composes: collageRightOverlay;
|
|
95
|
+
background-color: transparent !important;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.root :global [id*='jarallax-container'] video,
|
|
99
|
+
.root :global [id*='jarallax-container'] iframe,
|
|
100
|
+
.root :global [id*='jarallax-container'] img {
|
|
101
|
+
margin: auto !important;
|
|
102
|
+
transform: none !important;
|
|
103
|
+
}
|