@riosst100/pwa-marketplace 1.3.2 → 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 +10 -10
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.module.css +57 -0
- 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
|
@@ -2,8 +2,9 @@ import React, { Fragment, Suspense } from 'react';
|
|
|
2
2
|
import { shape, string } from 'prop-types';
|
|
3
3
|
import { Link, Route } from 'react-router-dom';
|
|
4
4
|
|
|
5
|
-
import AccountTrigger from '@
|
|
6
|
-
import CartTrigger from '@
|
|
5
|
+
import AccountTrigger from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/accountTrigger';
|
|
6
|
+
import CartTrigger from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/cartTrigger';
|
|
7
|
+
import WishlistTrigger from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/wishlistTrigger';
|
|
7
8
|
import NavTrigger from '@magento/venia-ui/lib/components/Header/navTrigger';
|
|
8
9
|
import SearchTrigger from '@magento/venia-ui/lib/components/Header/searchTrigger';
|
|
9
10
|
import OnlineIndicator from '@magento/venia-ui/lib/components/Header/onlineIndicator';
|
|
@@ -14,7 +15,8 @@ import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
|
14
15
|
import defaultClasses from '@magento/venia-ui/lib/components/Header/header.module.css';
|
|
15
16
|
import StoreSwitcher from '@magento/venia-ui/lib/components/Header/storeSwitcher';
|
|
16
17
|
import WebsiteSwitcher from '@riosst100/pwa-marketplace/src/components/WebsiteSwitcher/websiteSwitcher';
|
|
17
|
-
import CurrencySwitcher from '@magento/venia-ui/lib/components/Header/currencySwitcher';
|
|
18
|
+
// import CurrencySwitcher from '@magento/venia-ui/lib/components/Header/currencySwitcher';
|
|
19
|
+
import CurrencySwitcher from '@riosst100/pwa-marketplace/src/components/CurrencySwitcher';
|
|
18
20
|
import BecomeSellerLink from '@riosst100/pwa-marketplace/src/components/BecomeSellerLink/becomeSellerLink';
|
|
19
21
|
import MegaMenu from '@magento/venia-ui/lib/components/MegaMenu';
|
|
20
22
|
import PageLoadingIndicator from '@magento/venia-ui/lib/components/PageLoadingIndicator';
|
|
@@ -60,8 +62,8 @@ const Header = props => {
|
|
|
60
62
|
return (
|
|
61
63
|
<Fragment>
|
|
62
64
|
<PageLoadingIndicator absolute />
|
|
63
|
-
<div className={classes.switchersContainer}>
|
|
64
|
-
<div className={classes.switchers} data-cy="Header-switchers">
|
|
65
|
+
<div className={cn(classes.switchersContainer, '!bg-white border-b border-gray-100')}>
|
|
66
|
+
<div className={cn(classes.switchers, 'flex flex-row gap-x-[25px] !py-2')} data-cy="Header-switchers">
|
|
65
67
|
<BecomeSellerLink />
|
|
66
68
|
<WebsiteSwitcher />
|
|
67
69
|
<StoreSwitcher />
|
|
@@ -83,27 +85,28 @@ const Header = props => {
|
|
|
83
85
|
<small>Toys | Card | Games</small>
|
|
84
86
|
</Link>
|
|
85
87
|
</div>
|
|
86
|
-
<div className='flex'>
|
|
88
|
+
<div className='flex flex-auto max-w-[700px]'>
|
|
87
89
|
<Suspense fallback={searchBarFallback}>
|
|
88
90
|
<Route>
|
|
89
91
|
<SearchBar isOpen={true} ref={searchRef} />
|
|
90
92
|
</Route>
|
|
91
93
|
</Suspense>
|
|
92
94
|
</div>
|
|
93
|
-
<div className={classes.secondaryActions}>
|
|
95
|
+
<div className={cn(classes.secondaryActions, 'lg_gap-x-5 pl-5 border-l-[1px] border-gray-100')}>
|
|
94
96
|
{/* <SearchTrigger
|
|
95
97
|
onClick={handleSearchTriggerClick}
|
|
96
98
|
ref={searchTriggerRef}
|
|
97
99
|
/> */}
|
|
98
|
-
<
|
|
100
|
+
<WishlistTrigger />
|
|
99
101
|
<CartTrigger />
|
|
102
|
+
<AccountTrigger />
|
|
100
103
|
</div>
|
|
101
104
|
</div>
|
|
102
105
|
</div>
|
|
103
106
|
<MegaMenu
|
|
104
107
|
rootClassName={cn('nav-menu w-full max-w-[1210px] px-[15px] mx-[auto] flex-row gap-x-[40px]')}
|
|
105
108
|
megaMenuItemClassname={cn('px-0 py-[15px] leading-[20px]')}
|
|
106
|
-
titleClassName={cn('font-medium leading-[20px]')}
|
|
109
|
+
titleClassName={cn('font-medium leading-[20px] text-darkblue-900')}
|
|
107
110
|
/>
|
|
108
111
|
</header>
|
|
109
112
|
<OnlineIndicator
|
|
@@ -5,9 +5,12 @@ import { useStoreSwitcher } from '@magento/peregrine/lib/talons/Header/useStoreS
|
|
|
5
5
|
import { availableRoutes } from '@magento/venia-ui/lib/components/Routes/routes';
|
|
6
6
|
|
|
7
7
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
8
|
-
import defaultClasses from '@
|
|
8
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.module.css';
|
|
9
9
|
import SwitcherItem from '@magento/venia-ui/lib/components/Header/switcherItem';
|
|
10
10
|
import Shimmer from '@magento/venia-ui/lib/components/Header/storeSwitcher.shimmer';
|
|
11
|
+
import cn from 'classnames';
|
|
12
|
+
import { ArrowUp2 } from 'iconsax-react';
|
|
13
|
+
import { darkBlue } from '@riosst100/pwa-marketplace/src/theme/vars';
|
|
11
14
|
|
|
12
15
|
const StoreSwitcher = props => {
|
|
13
16
|
const {
|
|
@@ -29,11 +32,13 @@ const StoreSwitcher = props => {
|
|
|
29
32
|
|
|
30
33
|
const groups = [];
|
|
31
34
|
|
|
35
|
+
const hasOnlyOneStore = availableStores.size === 1;
|
|
36
|
+
|
|
32
37
|
storeGroups.forEach((group, key) => {
|
|
33
38
|
const stores = [];
|
|
34
39
|
group.forEach(({ storeName, isCurrent, storeCode, websiteCode }) => {
|
|
35
40
|
let label = `${storeName}`;
|
|
36
|
-
|
|
41
|
+
|
|
37
42
|
stores.push(
|
|
38
43
|
<li
|
|
39
44
|
aria-selected={currentStoreName}
|
|
@@ -57,7 +62,7 @@ const StoreSwitcher = props => {
|
|
|
57
62
|
groups.push(
|
|
58
63
|
<ul
|
|
59
64
|
role="listbox"
|
|
60
|
-
className={classes.groupList}
|
|
65
|
+
className={cn(classes.groupList, 'text-[13px]')}
|
|
61
66
|
key={key}
|
|
62
67
|
data-cy="StoreSwitcher-group"
|
|
63
68
|
>
|
|
@@ -67,24 +72,33 @@ const StoreSwitcher = props => {
|
|
|
67
72
|
});
|
|
68
73
|
|
|
69
74
|
return (
|
|
70
|
-
<div className={classes.root} data-cy="StoreSwitcher-root">
|
|
75
|
+
<div className={cn(classes.root, 'leading-[16px]')} data-cy="StoreSwitcher-root">
|
|
71
76
|
<button
|
|
72
77
|
data-cy="StoreSwitcher-triggerButton"
|
|
73
|
-
className={classes.trigger}
|
|
78
|
+
className={cn(classes.trigger, 'text-[13px]')}
|
|
74
79
|
aria-label={currentStoreName || ''}
|
|
75
80
|
onClick={handleTriggerClick}
|
|
76
81
|
ref={storeMenuTriggerRef}
|
|
77
|
-
data-cy="StoreSwitcher-trigger"
|
|
78
82
|
aria-expanded={storeMenuIsOpen}
|
|
79
83
|
>
|
|
80
|
-
|
|
84
|
+
<span className='flex flex-row gap-[5px] items-center leading-[16px] text-darkblue-900'>
|
|
85
|
+
{currentStoreName || ''}
|
|
86
|
+
{!hasOnlyOneStore ? (
|
|
87
|
+
<ArrowUp2 size="12" color={darkBlue} className={cn(storeMenuIsOpen ? 'rotate-0 ' : 'rotate-180', 'transition-all stroke-current')} variant="Outline" />
|
|
88
|
+
) : null}
|
|
89
|
+
</span>
|
|
81
90
|
</button>
|
|
82
91
|
<div
|
|
83
92
|
ref={storeMenuRef}
|
|
84
93
|
className={menuClassName}
|
|
85
94
|
data-cy="StoreSwitcher-menu"
|
|
86
95
|
>
|
|
87
|
-
<div className={classes.groups}>
|
|
96
|
+
<div className={cn(classes.groups, 'text-darkblue-900')}>
|
|
97
|
+
<span className='flex font-medium px-4 py-1 w-full text-[14px]'>
|
|
98
|
+
Language
|
|
99
|
+
</span>
|
|
100
|
+
{groups}
|
|
101
|
+
</div>
|
|
88
102
|
</div>
|
|
89
103
|
</div>
|
|
90
104
|
);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: grid from global;
|
|
3
|
+
composes: items-center from global;
|
|
4
|
+
composes: justify-items-start from global;
|
|
5
|
+
composes: mx-auto from global;
|
|
6
|
+
composes: my-0 from global;
|
|
7
|
+
composes: relative from global;
|
|
8
|
+
composes: sm_justify-items-end from global;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.trigger {
|
|
12
|
+
composes: max-w-[15rem] from global;
|
|
13
|
+
composes: overflow-ellipsis from global;
|
|
14
|
+
composes: overflow-hidden from global;
|
|
15
|
+
composes: whitespace-nowrap from global;
|
|
16
|
+
|
|
17
|
+
composes: sm_max-w-full from global;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.menu {
|
|
21
|
+
composes: absolute from global;
|
|
22
|
+
composes: bg-white from global;
|
|
23
|
+
composes: border from global;
|
|
24
|
+
composes: border-solid from global;
|
|
25
|
+
composes: border-subtle from global;
|
|
26
|
+
composes: bottom-md from global;
|
|
27
|
+
composes: left-xs from global;
|
|
28
|
+
composes: max-w-[90vw] from global;
|
|
29
|
+
composes: opacity-0 from global;
|
|
30
|
+
composes: pb-2xs from global;
|
|
31
|
+
composes: pt-2xs from global;
|
|
32
|
+
composes: right-auto from global;
|
|
33
|
+
composes: rounded from global;
|
|
34
|
+
composes: shadow-menu from global;
|
|
35
|
+
composes: top-auto from global;
|
|
36
|
+
composes: w-max from global;
|
|
37
|
+
composes: z-menu from global;
|
|
38
|
+
transform: translate3d(0, -8px, 0);
|
|
39
|
+
transition-duration: 192ms;
|
|
40
|
+
transition-timing-function: var(--venia-global-anim-out);
|
|
41
|
+
transition-property: opacity, transform, visibility;
|
|
42
|
+
|
|
43
|
+
/* TODO @TW: review (B6) */
|
|
44
|
+
/* composes: invisible from global; */
|
|
45
|
+
visibility: hidden;
|
|
46
|
+
|
|
47
|
+
composes: sm_bottom-auto from global;
|
|
48
|
+
composes: sm_left-auto from global;
|
|
49
|
+
composes: sm_right-xs from global;
|
|
50
|
+
composes: sm_top-md from global;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.menu_open {
|
|
54
|
+
composes: menu;
|
|
55
|
+
|
|
56
|
+
composes: opacity-100 from global;
|
|
57
|
+
transform: translate3d(0, 4px, 0);
|
|
58
|
+
transition-duration: 224ms;
|
|
59
|
+
transition-timing-function: var(--venia-global-anim-in);
|
|
60
|
+
|
|
61
|
+
/* TODO @TW: review (B6) */
|
|
62
|
+
/* composes: visible from global; */
|
|
63
|
+
visibility: visible;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.menuItem {
|
|
67
|
+
composes: hover_bg-subtle from global;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.groups {
|
|
71
|
+
composes: max-h-[24rem] from global;
|
|
72
|
+
composes: overflow-auto from global;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.groupList {
|
|
76
|
+
composes: border-b from global;
|
|
77
|
+
composes: border-solid from global;
|
|
78
|
+
composes: border-subtle from global;
|
|
79
|
+
composes: pb-2xs from global;
|
|
80
|
+
composes: pt-2xs from global;
|
|
81
|
+
|
|
82
|
+
composes: last_border-none from global;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* Mobile-specific styles.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
@media (max-width: 639px) {
|
|
90
|
+
.root:only-child {
|
|
91
|
+
grid-column: 2;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* TODO @TW: cannot compose */
|
|
95
|
+
.root:last-child .menu {
|
|
96
|
+
right: 1rem;
|
|
97
|
+
left: auto;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.menu {
|
|
101
|
+
transform: translate3d(0, 8px, 0);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.menu_open {
|
|
105
|
+
transform: translate3d(0, -4px, 0);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
4
|
+
import { Heart } from 'iconsax-react';
|
|
5
|
+
import { darkBlue } from '@riosst100/pwa-marketplace/src/theme/vars';
|
|
6
|
+
import cn from 'classnames';
|
|
7
|
+
|
|
8
|
+
const wishlistTrigger = () => {
|
|
9
|
+
return (
|
|
10
|
+
<div className='wishlistTrigger'>
|
|
11
|
+
<Link
|
|
12
|
+
aria-label='wishlist-action'
|
|
13
|
+
to={resourceUrl('/wishlist')}
|
|
14
|
+
className={''}
|
|
15
|
+
data-cy="wishlistLink"
|
|
16
|
+
>
|
|
17
|
+
<Heart size="30" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
|
|
18
|
+
</Link>
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default wishlistTrigger
|
|
@@ -85,7 +85,7 @@ const MegaMenuItem = props => {
|
|
|
85
85
|
]);
|
|
86
86
|
|
|
87
87
|
const maybeDownArrowIcon = category.children.length ? (
|
|
88
|
-
<ArrowDown2 className='ml-2' size="16" color={textPrimary} variant="Outline" />
|
|
88
|
+
<ArrowDown2 className='ml-2 stroke-current' size="16" color={textPrimary} variant="Outline" />
|
|
89
89
|
) : null;
|
|
90
90
|
|
|
91
91
|
const linkAttributes = category.children.length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './pagination';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import {
|
|
4
|
+
ChevronLeft as ChevronLeftIcon,
|
|
5
|
+
ChevronRight as ChevronRightIcon,
|
|
6
|
+
FastForward as FastForwardIcon,
|
|
7
|
+
Rewind as RewindIcon
|
|
8
|
+
} from 'react-feather';
|
|
9
|
+
import cn from 'classnames';
|
|
10
|
+
import { ArrowLeft2, ArrowRight2 } from 'iconsax-react';
|
|
11
|
+
import { blue } from '@riosst100/pwa-marketplace/src/theme/vars';
|
|
12
|
+
|
|
13
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
14
|
+
import Icon from '@magento/venia-ui/lib/components/Icon';
|
|
15
|
+
import defaultClasses from '@magento/venia-ui/lib/components/Pagination/navButton.module.css';
|
|
16
|
+
|
|
17
|
+
const icons = new Map()
|
|
18
|
+
.set('ChevronLeft', ChevronLeftIcon)
|
|
19
|
+
.set('ChevronRight', ChevronRightIcon)
|
|
20
|
+
.set('FastForward', FastForwardIcon)
|
|
21
|
+
.set('Rewind', RewindIcon);
|
|
22
|
+
|
|
23
|
+
const NavButton = props => {
|
|
24
|
+
const { active, buttonLabel, name, onClick } = props;
|
|
25
|
+
const iconSrc = icons.get(name);
|
|
26
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
27
|
+
|
|
28
|
+
const iconClass = active ? classes.icon : classes.icon_disabled;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<button
|
|
32
|
+
aria-label={buttonLabel}
|
|
33
|
+
className={cn(
|
|
34
|
+
classes.root,
|
|
35
|
+
'border-[1px] border-gray-100 rounded-[5px] !min-h-auto h-fit min-w-[40px] px-[10px] py-[7px]'
|
|
36
|
+
)}
|
|
37
|
+
disabled={!active}
|
|
38
|
+
onClick={onClick}
|
|
39
|
+
>
|
|
40
|
+
{name === 'ChevronLeft' && (
|
|
41
|
+
<ArrowLeft2 size={14} color={blue} className={cn(`stroke-[${blue}]`)} variant="Outline" />
|
|
42
|
+
)}
|
|
43
|
+
{name === 'ChevronRight' && (
|
|
44
|
+
<ArrowRight2 size={14} color={blue} className={cn(`stroke-[${blue}]`)} variant="Outline" />
|
|
45
|
+
)}
|
|
46
|
+
{name !== 'ChevronRight' && name !== 'ChevronLeft' && (
|
|
47
|
+
<Icon className={iconClass} size={20} src={iconSrc} />
|
|
48
|
+
)}
|
|
49
|
+
</button>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default NavButton;
|
|
54
|
+
|
|
55
|
+
NavButton.propTypes = {
|
|
56
|
+
classes: shape({
|
|
57
|
+
icon: string,
|
|
58
|
+
icon_disabled: string,
|
|
59
|
+
root: string
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
NavButton.defaultProps = {
|
|
64
|
+
buttonLabel: 'move to another page'
|
|
65
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { func, number, shape, string } from 'prop-types';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
import { usePagination } from '@magento/peregrine/lib/talons/Pagination/usePagination';
|
|
5
|
+
|
|
6
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
7
|
+
import defaultClasses from '@magento/venia-ui/lib/components/Pagination/pagination.module.css';
|
|
8
|
+
import Tile from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Pagination/tile';
|
|
9
|
+
import NavButton from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Pagination/navButton';
|
|
10
|
+
import { navButtons } from '@magento/venia-ui/lib/components/Pagination/constants';
|
|
11
|
+
import cn from 'classnames';
|
|
12
|
+
|
|
13
|
+
const Pagination = props => {
|
|
14
|
+
const { currentPage, setPage, totalPages } = props.pageControl;
|
|
15
|
+
const { formatMessage } = useIntl();
|
|
16
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
17
|
+
|
|
18
|
+
const talonProps = usePagination({
|
|
19
|
+
currentPage,
|
|
20
|
+
setPage,
|
|
21
|
+
totalPages
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
handleLeftSkip,
|
|
26
|
+
handleRightSkip,
|
|
27
|
+
handleNavBack,
|
|
28
|
+
handleNavForward,
|
|
29
|
+
isActiveLeft,
|
|
30
|
+
isActiveRight,
|
|
31
|
+
tiles
|
|
32
|
+
} = talonProps;
|
|
33
|
+
|
|
34
|
+
const navigationTiles = useMemo(
|
|
35
|
+
() =>
|
|
36
|
+
tiles.map(tileNumber => {
|
|
37
|
+
return (
|
|
38
|
+
<Tile
|
|
39
|
+
isActive={tileNumber === currentPage}
|
|
40
|
+
key={tileNumber}
|
|
41
|
+
number={tileNumber}
|
|
42
|
+
onClick={setPage}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}),
|
|
46
|
+
[currentPage, tiles, setPage]
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if (totalPages === 1) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className={cn(classes.root, 'gap-x-[10px] !border-0')} data-cy="Pagination-root">
|
|
55
|
+
{/* <NavButton
|
|
56
|
+
name={navButtons.firstPage.name}
|
|
57
|
+
active={isActiveLeft}
|
|
58
|
+
onClick={handleLeftSkip}
|
|
59
|
+
buttonLabel={formatMessage({
|
|
60
|
+
id: 'pagination.firstPage',
|
|
61
|
+
defaultMessage: navButtons.firstPage.buttonLabel
|
|
62
|
+
})}
|
|
63
|
+
/> */}
|
|
64
|
+
<NavButton
|
|
65
|
+
name={navButtons.prevPage.name}
|
|
66
|
+
active={isActiveLeft}
|
|
67
|
+
onClick={handleNavBack}
|
|
68
|
+
buttonLabel={formatMessage({
|
|
69
|
+
id: 'pagination.prevPage',
|
|
70
|
+
defaultMessage: navButtons.prevPage.buttonLabel
|
|
71
|
+
})}
|
|
72
|
+
/>
|
|
73
|
+
{navigationTiles}
|
|
74
|
+
<NavButton
|
|
75
|
+
name={navButtons.nextPage.name}
|
|
76
|
+
active={isActiveRight}
|
|
77
|
+
onClick={handleNavForward}
|
|
78
|
+
buttonLabel={formatMessage({
|
|
79
|
+
id: 'pagination.nextPage',
|
|
80
|
+
defaultMessage: navButtons.nextPage.buttonLabel
|
|
81
|
+
})}
|
|
82
|
+
/>
|
|
83
|
+
{/* <NavButton
|
|
84
|
+
name={navButtons.lastPage.name}
|
|
85
|
+
active={isActiveRight}
|
|
86
|
+
onClick={handleRightSkip}
|
|
87
|
+
buttonLabel={formatMessage({
|
|
88
|
+
id: 'pagination.lastPage',
|
|
89
|
+
defaultMessage: navButtons.lastPage.buttonLabel
|
|
90
|
+
})}
|
|
91
|
+
/> */}
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
Pagination.propTypes = {
|
|
97
|
+
classes: shape({
|
|
98
|
+
root: string
|
|
99
|
+
}),
|
|
100
|
+
pageControl: shape({
|
|
101
|
+
currentPage: number,
|
|
102
|
+
setPage: func,
|
|
103
|
+
totalPages: number
|
|
104
|
+
}).isRequired
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default Pagination;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { bool, func, number, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
import defaultClasses from '@magento/venia-ui/lib/components/Pagination/tile.module.css';
|
|
6
|
+
import cn from 'classnames';
|
|
7
|
+
|
|
8
|
+
const Tile = props => {
|
|
9
|
+
const { isActive, number, onClick } = props;
|
|
10
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
11
|
+
const rootClass = isActive ? classes.root_active : classes.root;
|
|
12
|
+
const handleClick = useCallback(() => onClick(number), [onClick, number]);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<button
|
|
16
|
+
className={cn(
|
|
17
|
+
rootClass,
|
|
18
|
+
isActive ? 'bg-blue-600 !border-blue-600' : 'bg-white',
|
|
19
|
+
'border-[1px] border-gray-100 rounded-[5px] !min-h-auto h-fit min-w-[40px] px-[10px] py-[7px]'
|
|
20
|
+
)}
|
|
21
|
+
onClick={handleClick}
|
|
22
|
+
data-cy={isActive ? 'Tile-activeRoot' : 'Tile-root'}
|
|
23
|
+
>
|
|
24
|
+
<span className={cn(isActive ? '!text-white' : 'text-blue-600', 'text-base leading-[16px]')}>
|
|
25
|
+
{number}
|
|
26
|
+
</span>
|
|
27
|
+
</button>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Tile.propTypes = {
|
|
32
|
+
classes: shape({
|
|
33
|
+
root: string,
|
|
34
|
+
root_active: string
|
|
35
|
+
}),
|
|
36
|
+
isActive: bool,
|
|
37
|
+
number: number,
|
|
38
|
+
onClick: func
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Tile;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { arrayOf, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
|
|
6
|
+
import defaultClasses from './boolean.module.css';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Custom Attributes Boolean Type component.
|
|
10
|
+
*
|
|
11
|
+
* @typedef Boolean
|
|
12
|
+
* @kind functional component
|
|
13
|
+
*
|
|
14
|
+
* @param {props} props React component props
|
|
15
|
+
*
|
|
16
|
+
* @returns {React.Element} A React component that displays a Boolean Type Product Attribute.
|
|
17
|
+
*/
|
|
18
|
+
const Boolean = props => {
|
|
19
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
20
|
+
const { attribute_metadata = {}, selected_attribute_options = {} } = props;
|
|
21
|
+
|
|
22
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
23
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
24
|
+
) : null;
|
|
25
|
+
let attributeContent;
|
|
26
|
+
|
|
27
|
+
if (selected_attribute_options.attribute_option?.length > 0) {
|
|
28
|
+
const options = selected_attribute_options.attribute_option
|
|
29
|
+
.map(option => option.label)
|
|
30
|
+
.join(', ');
|
|
31
|
+
|
|
32
|
+
attributeContent = <div className={classes.content}>{options}</div>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Fragment>
|
|
37
|
+
{attributeLabel}
|
|
38
|
+
{attributeContent}
|
|
39
|
+
</Fragment>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Props for {@link Boolean}
|
|
45
|
+
*
|
|
46
|
+
* @typedef props
|
|
47
|
+
*
|
|
48
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
49
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
50
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
51
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
52
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
53
|
+
* @property {Object} selected_attribute_options An object containing the attribute selected options
|
|
54
|
+
* @property {Array} selected_attribute_options.attribute_option An array of the selected options
|
|
55
|
+
* @property {String} selected_attribute_options.attribute_option.label Label of the selected option
|
|
56
|
+
*/
|
|
57
|
+
Boolean.propTypes = {
|
|
58
|
+
classes: shape({
|
|
59
|
+
label: string,
|
|
60
|
+
content: string
|
|
61
|
+
}),
|
|
62
|
+
attribute_metadata: shape({
|
|
63
|
+
label: string
|
|
64
|
+
}),
|
|
65
|
+
selected_attribute_options: shape({
|
|
66
|
+
attribute_option: arrayOf(
|
|
67
|
+
shape({
|
|
68
|
+
label: string
|
|
69
|
+
})
|
|
70
|
+
)
|
|
71
|
+
})
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default Boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './boolean';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { FormattedDate } from 'react-intl';
|
|
4
|
+
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
|
|
7
|
+
import defaultClasses from './date.module.css';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Custom Attributes Date Type component.
|
|
11
|
+
*
|
|
12
|
+
* @typedef Date
|
|
13
|
+
* @kind functional component
|
|
14
|
+
*
|
|
15
|
+
* @param {props} props React component props
|
|
16
|
+
*
|
|
17
|
+
* @returns {React.Element} A React component that displays a Date Type Product Attribute.
|
|
18
|
+
*/
|
|
19
|
+
const Date = props => {
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
const { attribute_metadata = {}, entered_attribute_value = {} } = props;
|
|
22
|
+
|
|
23
|
+
const attributeLabel = attribute_metadata.label ? (
|
|
24
|
+
<div className={classes.label}>{attribute_metadata.label}</div>
|
|
25
|
+
) : null;
|
|
26
|
+
let attributeContent;
|
|
27
|
+
|
|
28
|
+
// TODO: Get correct data from GraphQl based on config time zone
|
|
29
|
+
if (entered_attribute_value.value) {
|
|
30
|
+
// Convert date to ISO-8601 format so Safari can also parse it
|
|
31
|
+
const isoFormattedDate = entered_attribute_value.value.replace(
|
|
32
|
+
' ',
|
|
33
|
+
'T'
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
attributeContent = (
|
|
37
|
+
<div className={classes.content}>
|
|
38
|
+
<FormattedDate
|
|
39
|
+
value={isoFormattedDate}
|
|
40
|
+
year="numeric"
|
|
41
|
+
month="short"
|
|
42
|
+
day="2-digit"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Fragment>
|
|
50
|
+
{attributeLabel}
|
|
51
|
+
{attributeContent}
|
|
52
|
+
</Fragment>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Props for {@link Date}
|
|
58
|
+
*
|
|
59
|
+
* @typedef props
|
|
60
|
+
*
|
|
61
|
+
* @property {Object} classes An object containing the class names for the attribute
|
|
62
|
+
* @property {String} classes.label CSS class for the attribute label
|
|
63
|
+
* @property {String} classes.content CSS class for the attribute content
|
|
64
|
+
* @property {Object} attribute_metadata An object containing the attribute metadata
|
|
65
|
+
* @property {String} attribute_metadata.label The attribute label
|
|
66
|
+
* @property {Object} entered_attribute_value An object containing the attribute value
|
|
67
|
+
* @property {String} entered_attribute_value.value Attribute value
|
|
68
|
+
*/
|
|
69
|
+
Date.propTypes = {
|
|
70
|
+
classes: shape({
|
|
71
|
+
label: string,
|
|
72
|
+
content: string
|
|
73
|
+
}),
|
|
74
|
+
attribute_metadata: shape({
|
|
75
|
+
label: string
|
|
76
|
+
}),
|
|
77
|
+
entered_attribute_value: shape({
|
|
78
|
+
value: string
|
|
79
|
+
})
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default Date;
|