@riosst100/pwa-marketplace 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/dependabot.yml +28 -28
- package/package.json +18 -18
- package/src/componentOverrideMapping.js +14 -0
- package/src/components/BecomeSellerLink/becomeSellerLink.js +1 -1
- package/src/components/BecomeSellerLink/becomeSellerLink.module.css +0 -4
- package/src/components/CurrencySwitcher/currencySwitcher.himmer.js +6 -0
- package/src/components/CurrencySwitcher/currencySwitcher.module.css +102 -0
- package/src/components/CurrencySwitcher/index.js +107 -0
- package/src/components/CurrencySwitcher/switcherItem.js +47 -0
- package/src/components/CurrencySwitcher/switcherItem.module.css +20 -0
- package/src/components/FilterOption/FilterOptionModal.module.css +90 -0
- package/src/components/FilterOption/filterOptionModal.js +48 -0
- package/src/components/FilterOptionModal/filterOptionModal.js +66 -0
- package/src/components/Header/becomeSellerLink.module.css +0 -4
- package/src/components/Header/websiteSwitcher.js +0 -1
- package/src/components/Header/websiteSwitcher.module.css +107 -111
- package/src/components/WebsiteSwitcher/websiteSwitcher.js +18 -6
- package/src/components/WebsiteSwitcher/websiteSwitcher.module.css +107 -111
- package/src/overwrites/peregrine/lib/talons/FilterModal/useFilterList.js +62 -0
- package/src/overwrites/peregrine/lib/talons/MegaMenu/useMegaMenuItem.js +66 -0
- package/src/overwrites/peregrine/lib/talons/MegaMenu/useSubMenu.js +20 -0
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +0 -2
- package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/index.js +1 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.js +77 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.module.css +39 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/NoProductsFound/noProductsFound.png +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.gql.js +17 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +91 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css +77 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +12 -14
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.shimmer.js +74 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/001.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/002.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/003.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/004.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/005.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/006.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/007.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/008.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/009.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/010.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/011.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/012.jpg +0 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/images/index.js +12 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/index.js +6 -0
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +112 -0
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.module.css +32 -0
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.shimmer.js +24 -0
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/index.js +2 -0
- package/src/overwrites/venia-ui/lib/components/Checkbox/checkbox.js +78 -0
- package/src/overwrites/venia-ui/lib/components/Checkbox/checkbox.module.css +73 -0
- package/src/overwrites/venia-ui/lib/components/Checkbox/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.js +60 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.module.css +21 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.js +65 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilters.module.css +17 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.js +18 -18
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterDefault.module.css +0 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItem.js +79 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.js +76 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.module.css +0 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadioGroup.js +86 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.js +265 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.module.css +20 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterBlock.js +135 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterBlock.module.css +25 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterFooter.js +49 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterFooter.module.css +10 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterModal.js +166 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterModal.module.css +87 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/filterSearch.module.css +3 -0
- package/src/overwrites/venia-ui/lib/components/FilterModal/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/__tests__/filterSidebar.spec.js +246 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +8 -8
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.module.css +57 -58
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.shimmer.js +24 -0
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/index.js +2 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/addToCartButton.js +116 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/addToCartButton.module.css +38 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/gallery.js +56 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/gallery.module.css +28 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/gallery.shimmer.js +39 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/index.js +3 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/item.js +204 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/item.module.css +109 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/item.shimmer.js +38 -0
- package/src/overwrites/venia-ui/lib/components/Gallery/star.js +12 -0
- package/src/overwrites/venia-ui/lib/components/Header/accountTrigger.js +98 -0
- package/src/overwrites/venia-ui/lib/components/Header/cartTrigger.js +116 -0
- package/src/overwrites/venia-ui/lib/components/Header/header.js +12 -9
- package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js +22 -8
- package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.module.css +107 -0
- package/src/overwrites/venia-ui/lib/components/Header/wishlistTrigger.js +23 -0
- package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +1 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +0 -1
- package/src/overwrites/venia-ui/lib/components/Pagination/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/Pagination/navButton.js +65 -0
- package/src/overwrites/venia-ui/lib/components/Pagination/pagination.js +107 -0
- package/src/overwrites/venia-ui/lib/components/Pagination/tile.js +41 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.js +74 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.js +82 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.js +85 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.js +104 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.module.css +22 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.js +74 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.js +99 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.module.css +13 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.js +88 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.module.css +13 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.js +94 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.module.css +13 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/attributeType.js +67 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/AttributeType/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/customAttributes.js +64 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/customAttributes.module.css +9 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/CustomAttributes/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.gql.js +7 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +413 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.module.css +203 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.js +180 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.module.css +102 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.shimmer.js +51 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/carousel.shimmer.module.css +7 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/thumbnail.js +108 -0
- package/src/overwrites/venia-ui/lib/components/ProductImageCarousel/thumbnail.module.css +47 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/index.js +2 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.js +233 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.module.css +65 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.shimmer.js +28 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.shimmer.module.css +10 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/sortItem.js +57 -0
- package/src/overwrites/venia-ui/lib/components/ProductSort/sortItem.module.css +23 -0
- package/src/overwrites/venia-ui/lib/components/QuantityStepper/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.js +94 -0
- package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.module.css +78 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/plainHtmlRenderer.js +17 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/richContent.js +59 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/richContent.module.css +146 -0
- package/src/overwrites/venia-ui/lib/components/RichContent/richContentRenderers.js +7 -0
- package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.module.css +1 -2
- package/src/overwrites/venia-ui/lib/components/SearchBar/searchField.js +3 -2
- package/src/overwrites/venia-ui/lib/components/TextInput/field.module.css +50 -0
- package/src/overwrites/venia-ui/lib/components/TextInput/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/TextInput/textInput.js +48 -0
- package/src/overwrites/venia-ui/lib/components/TextInput/textInput.module.css +21 -0
- package/src/talons/FilterOption/useFilterOptionModal.js +11 -0
- package/src/talons/FilterOptionModal/useFilterOptionModal.js +11 -0
- package/src/theme/vars.js +12 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { string, shape, array } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import GalleryItem from './item';
|
|
6
|
+
import GalleryItemShimmer from './item.shimmer';
|
|
7
|
+
import defaultClasses from './gallery.module.css';
|
|
8
|
+
import { useGallery } from '@magento/peregrine/lib/talons/Gallery/useGallery';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Renders a Gallery of items. If items is an array of nulls Gallery will render
|
|
12
|
+
* a placeholder item for each.
|
|
13
|
+
*
|
|
14
|
+
* @params {Array} props.items an array of items to render
|
|
15
|
+
*/
|
|
16
|
+
const Gallery = props => {
|
|
17
|
+
const { items } = props;
|
|
18
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
19
|
+
const talonProps = useGallery();
|
|
20
|
+
const { storeConfig } = talonProps;
|
|
21
|
+
|
|
22
|
+
const galleryItems = useMemo(
|
|
23
|
+
() =>
|
|
24
|
+
items.map((item, index) => {
|
|
25
|
+
if (item === null) {
|
|
26
|
+
return <GalleryItemShimmer key={index} />;
|
|
27
|
+
}
|
|
28
|
+
return (
|
|
29
|
+
<GalleryItem
|
|
30
|
+
key={item.id}
|
|
31
|
+
item={item}
|
|
32
|
+
storeConfig={storeConfig}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}),
|
|
36
|
+
[items, storeConfig]
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div data-cy="Gallery-root" className={classes.root} aria-busy="false">
|
|
41
|
+
<div className={classes.items}>{galleryItems}</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
Gallery.propTypes = {
|
|
47
|
+
classes: shape({
|
|
48
|
+
filters: string,
|
|
49
|
+
items: string,
|
|
50
|
+
pagination: string,
|
|
51
|
+
root: string
|
|
52
|
+
}),
|
|
53
|
+
items: array.isRequired
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default Gallery;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: grid from global;
|
|
3
|
+
composes: grid-cols-1 from global;
|
|
4
|
+
composes: leading-none from global;
|
|
5
|
+
grid-template-areas:
|
|
6
|
+
'actions'
|
|
7
|
+
'items';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.items {
|
|
11
|
+
composes: gap-xs from global;
|
|
12
|
+
composes: grid from global;
|
|
13
|
+
composes: mb-6 from global;
|
|
14
|
+
grid-area: items;
|
|
15
|
+
grid-template-columns: repeat(4, 1fr);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@media only screen and (max-width: 767px) {
|
|
19
|
+
.items {
|
|
20
|
+
grid-template-columns: repeat(3, 1fr);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@media only screen and (max-width: 575px) {
|
|
25
|
+
.items {
|
|
26
|
+
grid-template-columns: repeat(2, 1fr);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string, array, object } from 'prop-types';
|
|
3
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
4
|
+
|
|
5
|
+
import GalleryItemShimmer from './item.shimmer';
|
|
6
|
+
import defaultClasses from './gallery.module.css';
|
|
7
|
+
|
|
8
|
+
const GalleryShimmer = props => {
|
|
9
|
+
const { items, itemProps } = props;
|
|
10
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div className={classes.root} aria-live="polite" aria-busy="true">
|
|
14
|
+
<div className={classes.items}>
|
|
15
|
+
{items.map((item, index) => (
|
|
16
|
+
<GalleryItemShimmer key={index} {...itemProps} />
|
|
17
|
+
))}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
GalleryShimmer.defaultProps = {
|
|
24
|
+
items: [],
|
|
25
|
+
itemProps: {}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
GalleryShimmer.propTypes = {
|
|
29
|
+
classes: shape({
|
|
30
|
+
root: string,
|
|
31
|
+
items: string
|
|
32
|
+
}),
|
|
33
|
+
items: array,
|
|
34
|
+
itemProps: shape({
|
|
35
|
+
classes: object
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default GalleryShimmer;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { Info } from 'react-feather';
|
|
4
|
+
import { string, number, shape } from 'prop-types';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
import Price from '@magento/venia-ui/lib/components/Price';
|
|
7
|
+
import { UNCONSTRAINED_SIZE_KEY } from '@magento/peregrine/lib/talons/Image/useImage';
|
|
8
|
+
import { useGalleryItem } from '@magento/peregrine/lib/talons/Gallery/useGalleryItem';
|
|
9
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
10
|
+
|
|
11
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
12
|
+
import Image from '@magento/venia-ui/lib/components/Image';
|
|
13
|
+
import GalleryItemShimmer from './item.shimmer';
|
|
14
|
+
import defaultClasses from './item.module.css';
|
|
15
|
+
import WishlistGalleryButton from '@magento/venia-ui/lib/components/Wishlist/AddToListButton';
|
|
16
|
+
|
|
17
|
+
import AddToCartButton from './addToCartButton';
|
|
18
|
+
// eslint-disable-next-line no-unused-vars
|
|
19
|
+
import Rating from '@magento/venia-ui/lib/components/Rating';
|
|
20
|
+
import cn from 'classnames';
|
|
21
|
+
import { Verify } from 'iconsax-react';
|
|
22
|
+
import Star from './star';
|
|
23
|
+
|
|
24
|
+
// The placeholder image is 4:5, so we should make sure to size our product
|
|
25
|
+
// images appropriately.
|
|
26
|
+
const IMAGE_WIDTH = 300;
|
|
27
|
+
const IMAGE_HEIGHT = 375;
|
|
28
|
+
|
|
29
|
+
// Gallery switches from two columns to three at 640px.
|
|
30
|
+
const IMAGE_WIDTHS = new Map()
|
|
31
|
+
.set(640, IMAGE_WIDTH)
|
|
32
|
+
.set(UNCONSTRAINED_SIZE_KEY, 840);
|
|
33
|
+
|
|
34
|
+
const GalleryItem = props => {
|
|
35
|
+
const {
|
|
36
|
+
handleLinkClick,
|
|
37
|
+
item,
|
|
38
|
+
itemRef,
|
|
39
|
+
wishlistButtonProps,
|
|
40
|
+
isSupportedProductType
|
|
41
|
+
} = useGalleryItem(props);
|
|
42
|
+
|
|
43
|
+
const seller = item.seller ? item.seller.name : '';
|
|
44
|
+
|
|
45
|
+
const { storeConfig } = props;
|
|
46
|
+
|
|
47
|
+
const productUrlSuffix = storeConfig && storeConfig.product_url_suffix;
|
|
48
|
+
|
|
49
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
50
|
+
|
|
51
|
+
if (!item) {
|
|
52
|
+
return <GalleryItemShimmer classes={classes} />;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// eslint-disable-next-line no-unused-vars
|
|
56
|
+
const { name, price_range, small_image, url_key, rating_summary } = item;
|
|
57
|
+
|
|
58
|
+
const { url: smallImageURL } = small_image;
|
|
59
|
+
const productLink = resourceUrl(`/${url_key}${productUrlSuffix || ''}`);
|
|
60
|
+
|
|
61
|
+
const wishlistButton = wishlistButtonProps ? (
|
|
62
|
+
<WishlistGalleryButton {...wishlistButtonProps} />
|
|
63
|
+
) : null;
|
|
64
|
+
|
|
65
|
+
const addButton = isSupportedProductType ? (
|
|
66
|
+
<AddToCartButton item={item} urlSuffix={productUrlSuffix} />
|
|
67
|
+
) : (
|
|
68
|
+
<div className={classes.unavailableContainer}>
|
|
69
|
+
<Info />
|
|
70
|
+
<p>
|
|
71
|
+
<FormattedMessage
|
|
72
|
+
id={'galleryItem.unavailableProduct'}
|
|
73
|
+
defaultMessage={'Currently unavailable for purchase.'}
|
|
74
|
+
/>
|
|
75
|
+
</p>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
// fallback to regular price when final price is unavailable
|
|
80
|
+
const priceSource =
|
|
81
|
+
price_range.maximum_price.final_price ||
|
|
82
|
+
price_range.maximum_price.regular_price;
|
|
83
|
+
|
|
84
|
+
// Hide the Rating component until it is updated with the new look and feel (PWA-2512).
|
|
85
|
+
const ratingAverage = null;
|
|
86
|
+
// const ratingAverage = rating_summary ? (
|
|
87
|
+
// <Rating rating={rating_summary} />
|
|
88
|
+
// ) : null;
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Link
|
|
92
|
+
aria-label={name}
|
|
93
|
+
onClick={handleLinkClick}
|
|
94
|
+
to={productLink}
|
|
95
|
+
>
|
|
96
|
+
<div data-cy="GalleryItem-root" className={cn(classes.root, 'border border-gray-100 rounded-lg hover_shadow-type-1 ')} ref={itemRef}>
|
|
97
|
+
<div className={cn('item-product')}>
|
|
98
|
+
<Link
|
|
99
|
+
aria-label={name}
|
|
100
|
+
onClick={handleLinkClick}
|
|
101
|
+
to={productLink}
|
|
102
|
+
className={classes.images}
|
|
103
|
+
>
|
|
104
|
+
<Image
|
|
105
|
+
alt={name}
|
|
106
|
+
classes={{
|
|
107
|
+
image: classes.image,
|
|
108
|
+
loaded: classes.imageLoaded,
|
|
109
|
+
notLoaded: classes.imageNotLoaded,
|
|
110
|
+
root: classes.imageContainer
|
|
111
|
+
}}
|
|
112
|
+
height={IMAGE_HEIGHT}
|
|
113
|
+
resource={smallImageURL}
|
|
114
|
+
widths={IMAGE_WIDTHS}
|
|
115
|
+
/>
|
|
116
|
+
{ratingAverage}
|
|
117
|
+
</Link>
|
|
118
|
+
</div>
|
|
119
|
+
<div className={cn('item-info px-[15px] pt-[15px] pb-[20px]')}>
|
|
120
|
+
<Link
|
|
121
|
+
onClick={handleLinkClick}
|
|
122
|
+
to={productLink}
|
|
123
|
+
className={classes.name}
|
|
124
|
+
data-cy="GalleryItem-name"
|
|
125
|
+
>
|
|
126
|
+
<span>{name}</span>
|
|
127
|
+
</Link>
|
|
128
|
+
<div data-cy="GalleryItem-price" className={cn(classes.price, 'mb-2.5 pt-2.5')}>
|
|
129
|
+
<Price
|
|
130
|
+
value={priceSource.value}
|
|
131
|
+
currencyCode={priceSource.currency}
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<div data-cy="GalleryItem-Rating" className={cn('flex gap-[5px] items-center mb-2')}>
|
|
136
|
+
<Star />
|
|
137
|
+
<span className='text-[12px] leading-normal'>
|
|
138
|
+
{rating_summary}
|
|
139
|
+
</span>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div data-cy="GalleryItem-Seller" className={cn('flex gap-[5px] items-center')}>
|
|
143
|
+
<Verify size={17} className='text-blue-700' variant="Bold" />
|
|
144
|
+
<span className='text-[12px] text-gray-300 leading-normal'>
|
|
145
|
+
{seller}
|
|
146
|
+
</span>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
{/* <div className={classes.actionsContainer}>
|
|
150
|
+
{' '}
|
|
151
|
+
{addButton}
|
|
152
|
+
{wishlistButton}
|
|
153
|
+
</div> */}
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
</Link>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
GalleryItem.propTypes = {
|
|
161
|
+
classes: shape({
|
|
162
|
+
image: string,
|
|
163
|
+
imageLoaded: string,
|
|
164
|
+
imageNotLoaded: string,
|
|
165
|
+
imageContainer: string,
|
|
166
|
+
images: string,
|
|
167
|
+
name: string,
|
|
168
|
+
price: string,
|
|
169
|
+
root: string
|
|
170
|
+
}),
|
|
171
|
+
item: shape({
|
|
172
|
+
id: number.isRequired,
|
|
173
|
+
uid: string.isRequired,
|
|
174
|
+
name: string.isRequired,
|
|
175
|
+
small_image: shape({
|
|
176
|
+
url: string.isRequired
|
|
177
|
+
}),
|
|
178
|
+
stock_status: string.isRequired,
|
|
179
|
+
__typename: string.isRequired,
|
|
180
|
+
url_key: string.isRequired,
|
|
181
|
+
sku: string.isRequired,
|
|
182
|
+
price_range: shape({
|
|
183
|
+
maximum_price: shape({
|
|
184
|
+
final_price: shape({
|
|
185
|
+
value: number.isRequired,
|
|
186
|
+
currency: string.isRequired
|
|
187
|
+
}),
|
|
188
|
+
regular_price: shape({
|
|
189
|
+
value: number.isRequired,
|
|
190
|
+
currency: string.isRequired
|
|
191
|
+
}).isRequired,
|
|
192
|
+
discount: shape({
|
|
193
|
+
amount_off: number.isRequired
|
|
194
|
+
}).isRequired
|
|
195
|
+
}).isRequired
|
|
196
|
+
}).isRequired
|
|
197
|
+
}),
|
|
198
|
+
storeConfig: shape({
|
|
199
|
+
magento_wishlist_general_is_enabled: string.isRequired,
|
|
200
|
+
product_url_suffix: string
|
|
201
|
+
})
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export default GalleryItem;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: content-start from global;
|
|
3
|
+
composes: grid from global;
|
|
4
|
+
composes: gap-y-2xs from global;
|
|
5
|
+
composes: max-w-[315px] from global;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.images {
|
|
9
|
+
composes: grid from global;
|
|
10
|
+
grid-template-areas: 'main';
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.imageContainer {
|
|
15
|
+
grid-area: main;
|
|
16
|
+
composes: max-h-[215px] from global;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.image {
|
|
20
|
+
composes: block from global;
|
|
21
|
+
composes: h-full from global;
|
|
22
|
+
composes: object-cover from global;
|
|
23
|
+
composes: w-full from global;
|
|
24
|
+
transition: opacity 512ms ease-out;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.imageLoaded {
|
|
28
|
+
composes: absolute from global;
|
|
29
|
+
composes: left-0 from global;
|
|
30
|
+
composes: top-0 from global;
|
|
31
|
+
|
|
32
|
+
/* TODO @TW: review (B6) */
|
|
33
|
+
/* composes: visible from global; */
|
|
34
|
+
visibility: visible;
|
|
35
|
+
composes: opacity-100 from global;
|
|
36
|
+
border-top-left-radius: 8px;
|
|
37
|
+
border-top-right-radius: 8px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.imageNotLoaded {
|
|
41
|
+
composes: absolute from global;
|
|
42
|
+
composes: left-0 from global;
|
|
43
|
+
composes: top-0 from global;
|
|
44
|
+
|
|
45
|
+
/* TODO @TW: review (B6) */
|
|
46
|
+
/* composes: visible from global; */
|
|
47
|
+
visibility: visible;
|
|
48
|
+
|
|
49
|
+
/* TODO @TW: review (B6) */
|
|
50
|
+
/* composes: invisible from global; */
|
|
51
|
+
visibility: hidden;
|
|
52
|
+
|
|
53
|
+
composes: opacity-0 from global;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.imagePlaceholder {
|
|
57
|
+
composes: image;
|
|
58
|
+
|
|
59
|
+
composes: bg-subtle from global;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.actionsContainer {
|
|
63
|
+
composes: gap-x-xs from global;
|
|
64
|
+
composes: grid from global;
|
|
65
|
+
composes: pl-2xs from global;
|
|
66
|
+
grid-template-columns: auto auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* TODO @TW: cannot compose */
|
|
70
|
+
.actionsContainer:empty {
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.name {
|
|
75
|
+
composes: font-medium from global;
|
|
76
|
+
composes: text-[14px] from global;
|
|
77
|
+
composes: mb-[18px] from global;
|
|
78
|
+
display: -webkit-box;
|
|
79
|
+
-webkit-line-clamp: 2;
|
|
80
|
+
-webkit-box-orient: vertical;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
line-height: normal;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.name,
|
|
86
|
+
.price {
|
|
87
|
+
composes: text-colorDefault from global;
|
|
88
|
+
composes: text-[16px] from global;
|
|
89
|
+
composes: font-semibold from global;
|
|
90
|
+
min-height: 1rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.price {
|
|
94
|
+
padding-top: 2.5;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.unavailableContainer {
|
|
98
|
+
composes: bg-subtle from global;
|
|
99
|
+
composes: gap-x-2xs from global;
|
|
100
|
+
composes: grid from global;
|
|
101
|
+
composes: grid-flow-col from global;
|
|
102
|
+
composes: italic from global;
|
|
103
|
+
composes: items-center from global;
|
|
104
|
+
composes: justify-start from global;
|
|
105
|
+
composes: p-3 from global;
|
|
106
|
+
composes: text-sm from global;
|
|
107
|
+
composes: text-subtle from global;
|
|
108
|
+
composes: w-full from global;
|
|
109
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { transparentPlaceholder } from '@magento/peregrine/lib/util/images';
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
|
|
6
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
7
|
+
import Image from '@magento/venia-ui/lib/components/Image';
|
|
8
|
+
import defaultClasses from './item.module.css';
|
|
9
|
+
|
|
10
|
+
const GalleryItemShimmer = props => {
|
|
11
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className={classes.root} aria-live="polite" aria-busy="true">
|
|
15
|
+
<Shimmer key="product-image">
|
|
16
|
+
<Image
|
|
17
|
+
alt="Placeholder for gallery item image"
|
|
18
|
+
classes={{
|
|
19
|
+
image: classes.image,
|
|
20
|
+
root: classes.imageContainer
|
|
21
|
+
}}
|
|
22
|
+
src={transparentPlaceholder}
|
|
23
|
+
/>
|
|
24
|
+
</Shimmer>
|
|
25
|
+
<Shimmer width="100%" key="product-name" />
|
|
26
|
+
<Shimmer width={3} key="product-price" />
|
|
27
|
+
<Shimmer type="button" key="add-to-cart" />
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
GalleryItemShimmer.propTypes = {
|
|
33
|
+
classes: shape({
|
|
34
|
+
root: string
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default GalleryItemShimmer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
export const star = () => {
|
|
4
|
+
return (
|
|
5
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
+
<path d="M8.00887 2.04754L9.03554 4.10087C9.17554 4.38671 9.54887 4.66087 9.86387 4.71337L11.7247 5.02254C12.9147 5.22087 13.1947 6.08421 12.3372 6.93587L10.8905 8.38254C10.6455 8.62754 10.5114 9.10004 10.5872 9.43837L11.0014 11.2292C11.328 12.6467 10.5755 13.195 9.32137 12.4542L7.5772 11.4217C7.2622 11.235 6.74304 11.235 6.4222 11.4217L4.67804 12.4542C3.4297 13.195 2.67137 12.6409 2.99804 11.2292L3.4122 9.43837C3.48804 9.10004 3.35387 8.62754 3.10887 8.38254L1.6622 6.93587C0.810536 6.08421 1.0847 5.22087 2.2747 5.02254L4.13554 4.71337C4.4447 4.66087 4.81804 4.38671 4.95804 4.10087L5.9847 2.04754C6.5447 0.933372 7.4547 0.933372 8.00887 2.04754Z" fill="#F7C317" stroke="#F7C317" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
|
7
|
+
</svg>
|
|
8
|
+
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default star;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { Fragment, Suspense } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { shape, string } from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { useAccountTrigger } from '@magento/peregrine/lib/talons/Header/useAccountTrigger';
|
|
6
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
+
|
|
8
|
+
// import AccountChip from '../AccountChip';
|
|
9
|
+
import { User } from 'iconsax-react';
|
|
10
|
+
import { darkBlue } from '@riosst100/pwa-marketplace/src/theme/vars';
|
|
11
|
+
import cn from 'classnames';
|
|
12
|
+
|
|
13
|
+
import defaultClasses from '@magento/venia-ui/lib/components/Header/accountTrigger.module.css';
|
|
14
|
+
|
|
15
|
+
const AccountMenu = React.lazy(() => import('@magento/venia-ui/lib/components/AccountMenu'));
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The AccountTrigger component is the call to action in the site header
|
|
20
|
+
* that toggles the AccountMenu dropdown.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} props
|
|
23
|
+
* @param {Object} props.classes - CSS classes to override element styles.
|
|
24
|
+
*/
|
|
25
|
+
const AccountTrigger = props => {
|
|
26
|
+
const talonProps = useAccountTrigger();
|
|
27
|
+
const {
|
|
28
|
+
accountMenuIsOpen,
|
|
29
|
+
accountMenuRef,
|
|
30
|
+
accountMenuTriggerRef,
|
|
31
|
+
setAccountMenuIsOpen,
|
|
32
|
+
handleTriggerClick,
|
|
33
|
+
isUserSignedIn
|
|
34
|
+
} = talonProps;
|
|
35
|
+
|
|
36
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
37
|
+
const rootClassName = accountMenuIsOpen ? classes.root_open : classes.root;
|
|
38
|
+
const { formatMessage } = useIntl();
|
|
39
|
+
|
|
40
|
+
const ariaLabelMyMenu = formatMessage({
|
|
41
|
+
id: 'accountTrigger.ariaLabelMyMenu',
|
|
42
|
+
defaultMessage: 'Toggle My Account Menu'
|
|
43
|
+
});
|
|
44
|
+
const ariaLabelSignIn = formatMessage({
|
|
45
|
+
id: 'accountTrigger.ariaLabelSignIn',
|
|
46
|
+
defaultMessage: 'Sign In'
|
|
47
|
+
});
|
|
48
|
+
const ariaLabel = isUserSignedIn ? ariaLabelMyMenu : ariaLabelSignIn;
|
|
49
|
+
return (
|
|
50
|
+
<Fragment>
|
|
51
|
+
<div className={cn(rootClassName, '!h-auto')} ref={accountMenuTriggerRef}>
|
|
52
|
+
<button
|
|
53
|
+
aria-label={ariaLabel}
|
|
54
|
+
aria-expanded={accountMenuIsOpen}
|
|
55
|
+
className={cn(
|
|
56
|
+
classes.trigger,
|
|
57
|
+
'gap-[5px] !min-h-[30px] !h-auto !justify-between !min-w-min !w-fit',
|
|
58
|
+
)}
|
|
59
|
+
onClick={handleTriggerClick}
|
|
60
|
+
data-cy="AccountTrigger-trigger"
|
|
61
|
+
>
|
|
62
|
+
{/* <AccountChip
|
|
63
|
+
fallbackText={formatMessage({
|
|
64
|
+
id: 'accountTrigger.buttonFallback',
|
|
65
|
+
defaultMessage: 'Sign In'
|
|
66
|
+
})}
|
|
67
|
+
shouldIndicateLoading={true}
|
|
68
|
+
/> */}
|
|
69
|
+
<User size="30" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
|
|
70
|
+
<span className='text-sm text-darkblue-900 font-semibold'>
|
|
71
|
+
{formatMessage({
|
|
72
|
+
id: 'accountTrigger.buttonFallback',
|
|
73
|
+
defaultMessage: 'Sign In'
|
|
74
|
+
})}
|
|
75
|
+
</span>
|
|
76
|
+
</button>
|
|
77
|
+
</div>
|
|
78
|
+
<Suspense fallback={null}>
|
|
79
|
+
<AccountMenu
|
|
80
|
+
handleTriggerClick={handleTriggerClick}
|
|
81
|
+
ref={accountMenuRef}
|
|
82
|
+
accountMenuIsOpen={accountMenuIsOpen}
|
|
83
|
+
setAccountMenuIsOpen={setAccountMenuIsOpen}
|
|
84
|
+
/>
|
|
85
|
+
</Suspense>
|
|
86
|
+
</Fragment>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default AccountTrigger;
|
|
91
|
+
|
|
92
|
+
AccountTrigger.propTypes = {
|
|
93
|
+
classes: shape({
|
|
94
|
+
root: string,
|
|
95
|
+
root_open: string,
|
|
96
|
+
trigger: string
|
|
97
|
+
})
|
|
98
|
+
};
|