@evenicanpm/storefront-core 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +37 -0
- package/.storybook/preview.ts +14 -0
- package/README.md +17 -2
- package/__mocks__/next-font.js +4 -0
- package/package.json +19 -13
- package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +265 -5
- package/src/api-manager/schemas/product.schema.ts +2 -2
- package/src/api-manager/services/cart/mutations/add-discount-code.ts +11 -0
- package/src/api-manager/services/cart/mutations/checkout.ts +1 -1
- package/src/api-manager/services/create-query.ts +11 -4
- package/src/api-manager/services/product/queries/get-product-availability.ts +1 -2
- package/src/api-manager/services/user/mutations/add-to-wishlist.ts +2 -2
- package/src/api-manager/services/user/mutations/copy-cart-to-wishlist.ts +2 -1
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +4 -4
- package/src/api-manager/services/user/mutations/update-wishlist.ts +2 -1
- package/src/api-manager/services/user/queries/get-wishlist-details.ts +2 -2
- package/src/cms/blocks/components/product-carousel/index.tsx +6 -3
- package/src/cms/blocks/components/product-section-fullwidth/index.tsx +2 -2
- package/src/cms/blocks/components/shared/product-grid.tsx +5 -2
- package/src/cms/interfaces/navigation.ts +9 -9
- package/src/components/Blocks/Components/CategoryCarousel/index.tsx +3 -3
- package/src/components/Blocks/Components/HeroCarousel/index.tsx +2 -2
- package/src/components/Blocks/Components/ProductCarousel/index.tsx +5 -5
- package/src/components/Blocks/Components/ProductSectionFullWidth/index.tsx +6 -6
- package/src/components/Blocks/Components/Services/service-card.tsx +4 -1
- package/src/components/Blocks/Components/shared/featured-product-card.tsx +2 -2
- package/src/components/Blocks/Components/shared/product-category-item.tsx +3 -3
- package/src/components/Blocks/Components/shared/product-grid.tsx +2 -2
- package/src/components/Blocks/Components/shared/top-categories-card.tsx +1 -1
- package/src/components/Blocks/Components/shared/top-rating-product-card.tsx +6 -3
- package/src/components/Footer/sections/FooterAppStore.tsx +1 -1
- package/src/components/Footer/sections/FooterContact.tsx +1 -1
- package/src/components/Footer/sections/FooterLogo.tsx +2 -2
- package/src/components/Footer/sections/FooterSocialLinks.tsx +1 -1
- package/src/components/_components/MiniCartClient.tsx +2 -2
- package/src/components/_components/accordion/accordion-header.tsx +1 -1
- package/src/components/_components/carousel-cards/carousel-card-1/carousel-card-1.tsx +2 -2
- package/src/components/_components/carousel-cards/carousel-card-2/carousel-card-2.tsx +9 -4
- package/src/components/_components/carousel-cards/carousel-card-3/carousel-card-3.tsx +6 -3
- package/src/components/_components/carousel-cards/carousel-card-4/carousel-card-4.tsx +6 -1
- package/src/components/_components/categories/category-list/category-list.tsx +3 -3
- package/src/components/_components/categories/mega-menu/banner.tsx +7 -3
- package/src/components/_components/categories/mega-menu/column-list.tsx +3 -3
- package/src/components/_components/categories/mega-menu/mega-menu-1.tsx +2 -2
- package/src/components/_components/category-cards/category-card-1/category-card-1.tsx +2 -2
- package/src/components/_components/countdown/count-box.tsx +4 -1
- package/src/components/_components/countdown/count-down.tsx +1 -1
- package/src/components/_components/data-table/table-header.tsx +1 -1
- package/src/components/_components/footer/components/app-store.tsx +1 -1
- package/src/components/_components/footer/components/logo.tsx +2 -2
- package/src/components/_components/footer/components/social-links.tsx +1 -1
- package/src/components/_components/footer/footer-1.tsx +1 -1
- package/src/components/_components/footer/footer-2.tsx +2 -2
- package/src/components/_components/footer/footer-3.tsx +2 -2
- package/src/components/_components/footer/footer-4.tsx +3 -3
- package/src/components/_components/header/components/categories-menu.tsx +3 -3
- package/src/components/_components/header/components/mobile-header.tsx +9 -6
- package/src/components/_components/header/components/user.tsx +5 -5
- package/src/components/_components/header/header.tsx +2 -2
- package/src/components/_components/header/sticky-header.tsx +3 -3
- package/src/components/_components/mini-cart/components/cart-item.tsx +5 -2
- package/src/components/_components/mini-cart/components/empty-view.tsx +2 -2
- package/src/components/_components/mini-cart/components/top-header.tsx +5 -2
- package/src/components/_components/mini-cart/mini-cart.tsx +3 -3
- package/src/components/_components/mobile-navigation/mobile-navigation-bar.tsx +5 -5
- package/src/components/_components/nav-link/nav-link-2.tsx +1 -1
- package/src/components/_components/nav-link/nav-link-3.tsx +1 -1
- package/src/components/_components/navbar/categories.tsx +3 -3
- package/src/components/_components/navbar/category-based-menu/category-based-menu.tsx +1 -1
- package/src/components/_components/navbar/category-based-menu/components/child-categories.tsx +2 -2
- package/src/components/_components/navbar/mega-menu/category-list.tsx +1 -1
- package/src/components/_components/navbar/mega-menu/mega-menu.tsx +1 -1
- package/src/components/_components/navbar/mobile-menu/mobile-menu.tsx +2 -2
- package/src/components/_components/navbar/mobile-menu/render-levels.tsx +3 -3
- package/src/components/_components/navbar/nav-list/nav-item-child.tsx +3 -3
- package/src/components/_components/navbar/nav-list/nav-list.tsx +4 -4
- package/src/components/_components/newsletter/newsletter.tsx +5 -1
- package/src/components/_components/newsletter/social-icons.tsx +1 -1
- package/src/components/_components/page-sidenav/grocery-side-nav/components/link-item.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/components/list-item.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/components/nav-accordion.tsx +2 -2
- package/src/components/_components/page-sidenav/grocery-side-nav/grocery-side-nav.tsx +3 -3
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/list-item.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/nav-accordion.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/render-child.tsx +2 -2
- package/src/components/_components/page-sidenav/health-beauty-side-nav/health-beauty-side-nav.tsx +5 -5
- package/src/components/_components/page-sidenav/side-navbar/components/list-item.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar/components/nav-accordion.tsx +3 -3
- package/src/components/_components/page-sidenav/side-navbar/components/render-child.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar/side-nav-bar.tsx +4 -4
- package/src/components/_components/page-sidenav/side-navbar-2/components/sidebar-accordion.tsx +1 -1
- package/src/components/_components/page-sidenav/side-navbar-2/side-navbar-2.tsx +2 -2
- package/src/components/_components/product-cards/product-card-1/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-1/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-10/product-card.tsx +9 -5
- package/src/components/_components/product-cards/product-card-11/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-12/product-card.tsx +4 -4
- package/src/components/_components/product-cards/product-card-13/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-14/product-card.tsx +7 -4
- package/src/components/_components/product-cards/product-card-15/product-card.tsx +6 -3
- package/src/components/_components/product-cards/product-card-16/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-16/product-card.tsx +5 -2
- package/src/components/_components/product-cards/product-card-2/components/product-price.tsx +2 -2
- package/src/components/_components/product-cards/product-card-2/product-card.tsx +4 -4
- package/src/components/_components/product-cards/product-card-3/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-3/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-4/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-4/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-5/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-5/product-card.tsx +2 -2
- package/src/components/_components/product-cards/product-card-6/components/hover-actions.tsx +1 -1
- package/src/components/_components/product-cards/product-card-6/product-card.tsx +3 -3
- package/src/components/_components/product-cards/product-card-7/components/quantity-buttons.tsx +2 -2
- package/src/components/_components/product-cards/product-card-7/product-card.tsx +5 -2
- package/src/components/_components/product-cards/product-card-8/product-card.tsx +9 -5
- package/src/components/_components/product-cards/product-card-9/components/add-to-cart.tsx +5 -2
- package/src/components/_components/product-cards/product-card-9/product-card.tsx +1 -1
- package/src/components/_components/product-cards/product-price.tsx +2 -2
- package/src/components/_components/product-cards/product-rating.tsx +2 -2
- package/src/components/_components/product-cards/product-title.tsx +1 -1
- package/src/components/_components/product-cards/use-product.ts +1 -1
- package/src/components/_components/product-dimensions/product-dimensions.tsx +1 -1
- package/src/components/_components/product-quantity-buttons/product-quantity-buttons.tsx +2 -2
- package/src/components/_components/products-view/products-grid-view.tsx +2 -2
- package/src/components/_components/products-view/products-list-view.tsx +2 -2
- package/src/components/_components/search-box/components/category-dropdown.tsx +1 -1
- package/src/components/_components/search-box/components/search-result.tsx +1 -1
- package/src/components/_components/search-box/hooks/use-search.ts +1 -1
- package/src/components/_components/search-box/search-input-category.tsx +3 -3
- package/src/components/_components/service-cards/service-card-1/service-card-1.tsx +5 -2
- package/src/components/_components/service-cards/service-card-2/service-card-2.tsx +5 -2
- package/src/components/_components/service-cards/service-card-3/service-card-3.tsx +4 -1
- package/src/components/_components/settings/setting.tsx +3 -3
- package/src/components/_components/side-nav/side-nav.tsx +1 -1
- package/src/components/_components/stories/story-content/story-content.tsx +1 -1
- package/src/components/_components/stories/story-item/story-item.tsx +1 -1
- package/src/components/_components/topbar/top-bar.tsx +6 -3
- package/src/components/_components/wishlist-modal/wishlist-modal-item.tsx +1 -1
- package/src/components-v2/accordion/accordion-header.stories.tsx +28 -0
- package/src/components-v2/categories/category-list/category-list.tsx +2 -2
- package/src/components-v2/categories/category-list/styles.ts +3 -2
- package/src/components-v2/categories/mega-menu/column-list.tsx +1 -1
- package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +6 -3
- package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +2 -2
- package/src/components-v2/header/__tests__/user.test.tsx +12 -12
- package/src/components-v2/header/components/user.tsx +12 -11
- package/src/components-v2/mini-cart/mini-cart.tsx +9 -14
- package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +1 -1
- package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +2 -2
- package/src/components-v2/product-cards/favorite-button.tsx +52 -0
- package/src/components-v2/product-cards/product-card/product-card.tsx +87 -47
- package/src/components-v2/product-cards/product-card-plp/product-card.tsx +140 -51
- package/src/components-v2/product-cards/product-card-plp/styles/index.ts +17 -0
- package/src/components-v2/product-cards/product-card-plp-list/product-card.tsx +76 -42
- package/src/components-v2/product-cards/product-card-search/product-card.tsx +50 -21
- package/src/components-v2/product-cards/product-card-search/styles/index.ts +0 -10
- package/src/components-v2/product-dialog/compound/product-dialog.tsx +39 -15
- package/src/components-v2/product-quantity-buttons/compound/quantity-buttons-root.tsx +22 -7
- package/src/components-v2/product-quantity-variants/index.tsx +1 -1
- package/src/components-v2/products-view/compound/context.ts +46 -1
- package/src/components-v2/products-view/compound/products-grid-view.tsx +23 -14
- package/src/components-v2/products-view/compound/products-list-view.tsx +12 -3
- package/src/components-v2/search-bar/compound/context.ts +24 -3
- package/src/components-v2/search-bar/compound/results-item-lg.tsx +14 -13
- package/src/components-v2/search-bar/compound/results-item-sm.tsx +5 -5
- package/src/components-v2/search-bar/compound/results-suspense.tsx +3 -3
- package/src/components-v2/search-bar/compound/results.tsx +4 -4
- package/src/components-v2/search-bar/compound/textfield-adornment-category.tsx +1 -1
- package/src/components-v2/search-bar/compound/textfield.tsx +3 -3
- package/src/components-v2/search-bar/hooks/use-click-outside.ts +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/add-to-wishlist-button.tsx +2 -6
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-bottom-ui.tsx +6 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +22 -15
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +8 -7
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/context.ts +8 -8
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-item.tsx +29 -19
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/hooks/use-add-to-wishlist.ts +27 -77
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/index.tsx +1 -9
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui.tsx +7 -2
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +20 -12
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form.tsx +25 -5
- package/src/hooks/use-cart.ts +11 -14
- package/src/hooks/use-favorite.ts +17 -0
- package/src/hooks/use-variants.ts +4 -3
- package/src/pages/account/addresses/address-item.tsx +1 -1
- package/src/pages/account/dashboard-header.tsx +3 -3
- package/src/pages/account/navigation.tsx +5 -2
- package/src/pages/account/no-records.tsx +1 -1
- package/src/pages/account/orders/order-progress.tsx +5 -2
- package/src/pages/account/orders/order-row.tsx +4 -1
- package/src/pages/account/orders/order-summary.tsx +6 -2
- package/src/pages/account/orders/ordered-products.tsx +9 -2
- package/src/pages/account/profile/user-info.tsx +5 -2
- package/src/pages/account/wishlist/create-new-list.tsx +1 -1
- package/src/pages/account/wishlist/wishlist-item.tsx +2 -2
- package/src/pages/checkout/checkout-alt-form/address-card.tsx +5 -2
- package/src/pages/checkout/checkout-alt-form/checkout-step.tsx +3 -3
- package/src/pages/checkout/checkout-alt-form/customer-information.tsx +1 -1
- package/src/pages/checkout/checkout-alt-form/delivery-address.tsx +5 -1
- package/src/pages/checkout/checkout-alt-form/delivery-options.tsx +6 -2
- package/src/pages/checkout/checkout-alt-form/edit-address-form.tsx +1 -1
- package/src/pages/checkout/checkout-alt-form/heading.tsx +2 -2
- package/src/pages/checkout/checkout-alt-form/new-address-form.tsx +9 -4
- package/src/pages/checkout/checkout-alt-form/payment-details.tsx +6 -3
- package/src/pages/checkout/checkout-alt-summary/cart-item.tsx +5 -2
- package/src/pages/checkout/checkout-alt-summary/checkout-alt-summary.tsx +4 -2
- package/src/pages/checkout/checkout-alt-summary/list-item.tsx +2 -2
- package/src/pages/confirmation/address.tsx +4 -1
- package/src/pages/confirmation/confirmation-summary.tsx +6 -3
- package/src/pages/confirmation/ordered-products.tsx +9 -2
- package/src/pages/product-details/available-shops.tsx +5 -2
- package/src/pages/product-details/bopis/find-in-store-modal.tsx +1 -1
- package/src/pages/product-details/bopis/pickup-option-select.tsx +1 -1
- package/src/pages/product-details/frequently-bought.tsx +9 -2
- package/src/pages/product-details/frequently-product-card.tsx +8 -5
- package/src/pages/product-details/product-comment.tsx +7 -2
- package/src/pages/product-details/product-description.tsx +1 -1
- package/src/pages/product-details/product-filter-card.tsx +11 -3
- package/src/pages/product-details/product-intro/product-intro-images.tsx +4 -1
- package/src/pages/product-details/product-intro/product-intro.tsx +8 -5
- package/src/pages/product-details/product-review.tsx +5 -2
- package/src/pages/product-details/related-products.tsx +2 -2
- package/src/pages/product-list/facet-group.tsx +1 -1
- package/src/pages/product-list/list-filter.tsx +5 -2
- package/src/pages/product-list/pagination.tsx +1 -1
- package/src/pages/product-list/quick-view-dialog-content.tsx +2 -2
- package/src/pages/product-list/selected-facets.tsx +1 -1
- package/src/pages/quickorder/order-upload.tsx +1 -1
- package/src/pages/quickorder/quick-order-form.tsx +6 -3
- package/src/pages/quickorder/quick-order-row.tsx +1 -1
- package/src/pages-v2/account/account-navigation.tsx +1 -1
- package/src/pages-v2/account/orders/order-summary.tsx +5 -2
- package/src/pages-v2/account/profile/user-info.tsx +6 -3
- package/src/pages-v2/account/wishlist/wishlist-item.tsx +1 -1
- package/src/pages-v2/cart/__tests__/checkout-form.test.tsx +1 -1
- package/src/pages-v2/cart/estimate-shipping.tsx +3 -0
- package/src/pages-v2/checkout/checkout-alt-form/checkout-step.tsx +4 -4
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/address-card.tsx +1 -1
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/delivery-address.tsx +12 -5
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/new-address-form.tsx +27 -5
- package/src/pages-v2/checkout/checkout-alt-form/steps/address/styles.ts +2 -1
- package/src/pages-v2/checkout/checkout-alt-form/steps/customer-info/customer-information.tsx +27 -7
- package/src/pages-v2/checkout/checkout-alt-form/steps/shipping/delivery-options.tsx +8 -1
- package/src/pages-v2/confirmation/address.tsx +5 -1
- package/src/pages-v2/product-details/available-shops.tsx +4 -1
- package/src/pages-v2/product-details/bopis/find-in-store-button.tsx +1 -1
- package/src/pages-v2/product-details/bopis/find-in-store-modal.tsx +3 -5
- package/src/pages-v2/product-details/product-intro/compound/context.ts +69 -12
- package/src/pages-v2/product-details/product-intro/compound/product-info.tsx +73 -27
- package/src/pages-v2/product-details/product-intro/compound/product-intro-images.tsx +19 -6
- package/src/pages-v2/product-details/product-intro/utils.ts +2 -2
- package/src/pages-v2/product-details/product-tabs.tsx +19 -4
- package/src/pages-v2/product-details/related-products.tsx +3 -3
- package/src/pages-v2/quickorder/context.ts +2 -2
- package/src/pages-v2/quickorder/order-upload.tsx +6 -2
- package/src/pages-v2/quickorder/provider.tsx +24 -9
- package/src/pages-v2/quickorder/quick-order-actions.tsx +2 -2
- package/src/pages-v2/quickorder/quick-order-header.tsx +6 -3
- package/src/pages-v2/quickorder/quick-order-row.tsx +1 -1
- package/src/pages-v2/quickorder/quick-order-table.tsx +10 -4
- package/src/pages-v2/quickorder/quick-order-upload.tsx +2 -2
- package/src/stories/Button.stories.ts +54 -0
- package/src/stories/Button.tsx +35 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.ts +34 -0
- package/src/stories/Header.tsx +54 -0
- package/src/stories/Page.stories.ts +33 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/src/theme/build-mui-theme.ts +104 -0
- package/src/theme/components.ts +163 -0
- package/src/theme/emotion-cache.tsx +101 -0
- package/src/theme/theme-colors.ts +205 -0
- package/src/theme/theme-options-sample.ts +69 -0
- package/src/theme/theme-options.ts +172 -0
- package/src/theme/theme-provider.tsx +44 -0
- package/src/theme/typography.ts +22 -0
- package/src/theme/utils.ts +17 -0
- package/tsconfig.json +3 -1
- package/src/api-manager/lib/cart-cookie-handler.ts +0 -14
- package/src/components-v2/product-cards/product-card/components/hover-actions.tsx +0 -37
- package/src/components-v2/product-cards/product-card-plp/components/quantity-buttons.tsx +0 -54
- package/src/components-v2/product-cards/product-card-plp-list/components/add-to-cart.tsx +0 -63
- package/src/components-v2/product-cards/product-card-plp-list/components/favorite-button.tsx +0 -27
- package/src/components-v2/product-cards/use-product.ts +0 -35
- package/src/components-v2/products-view/products-grid-view.tsx +0 -65
- package/src/components-v2/products-view/products-list-view.tsx +0 -66
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/context.ts +0 -2
- /package/src/components-v2/product-cards/{product-card/components/quantity-buttons.tsx → quantity-buttons.tsx} +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { components } from "./components";
|
|
2
|
+
import { typography } from "./typography";
|
|
3
|
+
import { primary, themeColors } from "./theme-colors";
|
|
4
|
+
|
|
5
|
+
/********************************************
|
|
6
|
+
* You can delete themeOptions.ts file and
|
|
7
|
+
* rename this file to `themeOptions.ts`
|
|
8
|
+
* Follow the documentation for more details
|
|
9
|
+
*********************************************/
|
|
10
|
+
|
|
11
|
+
const THEMES = {
|
|
12
|
+
GIFT: "GIFT",
|
|
13
|
+
HEALTH: "HEALTH",
|
|
14
|
+
DEFAULT: "DEFAULT",
|
|
15
|
+
GROCERY: "GROCERY",
|
|
16
|
+
FURNITURE: "FURNITURE",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const breakpoints = {
|
|
20
|
+
values: {
|
|
21
|
+
xs: 0,
|
|
22
|
+
sm: 600,
|
|
23
|
+
md: 960,
|
|
24
|
+
lg: 1280,
|
|
25
|
+
xl: 1600,
|
|
26
|
+
xxl: 1920,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const themesOptionList = {
|
|
31
|
+
[THEMES.DEFAULT]: {
|
|
32
|
+
typography,
|
|
33
|
+
breakpoints,
|
|
34
|
+
components: { ...components },
|
|
35
|
+
palette: { primary: { ...primary, light: primary[100] }, ...themeColors },
|
|
36
|
+
},
|
|
37
|
+
// [THEMES.GROCERY]: {
|
|
38
|
+
// typography,
|
|
39
|
+
// breakpoints,
|
|
40
|
+
// components: { ...components },
|
|
41
|
+
// palette: { primary: { ...primary, light: primary[100] }, ...themeColors },
|
|
42
|
+
// },
|
|
43
|
+
// [THEMES.FURNITURE]: {
|
|
44
|
+
// typography,
|
|
45
|
+
// breakpoints,
|
|
46
|
+
// components: { ...components },
|
|
47
|
+
// palette: { primary: { ...paste, light: paste[100] }, ...themeColors },
|
|
48
|
+
// },
|
|
49
|
+
// [THEMES.HEALTH]: {
|
|
50
|
+
// typography,
|
|
51
|
+
// breakpoints,
|
|
52
|
+
// components: { ...components },
|
|
53
|
+
// palette: { primary: { ...blue, light: blue[100] }, ...themeColors },
|
|
54
|
+
// },
|
|
55
|
+
// [THEMES.GIFT]: {
|
|
56
|
+
// typography,
|
|
57
|
+
// breakpoints,
|
|
58
|
+
// components: { ...components },
|
|
59
|
+
// palette: { primary: { ...marron, light: marron[100] }, ...themeColors },
|
|
60
|
+
// },
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const themeOptions = () => {
|
|
64
|
+
// YOU CAN SET ANOTHER THEME HERE E.G. [THEMES.GROCERY] OR [THEMES.FURNITURE] ETC.
|
|
65
|
+
const themeOption = themesOptionList[THEMES.DEFAULT];
|
|
66
|
+
return themeOption;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default themeOptions;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { components } from "./components";
|
|
2
|
+
import { typography } from "./typography";
|
|
3
|
+
import {
|
|
4
|
+
blue,
|
|
5
|
+
marron,
|
|
6
|
+
paste,
|
|
7
|
+
primary,
|
|
8
|
+
themeColors,
|
|
9
|
+
orange,
|
|
10
|
+
bluish,
|
|
11
|
+
success,
|
|
12
|
+
warning,
|
|
13
|
+
gold,
|
|
14
|
+
} from "./theme-colors";
|
|
15
|
+
|
|
16
|
+
const THEMES = {
|
|
17
|
+
GIFT: "GIFT",
|
|
18
|
+
HEALTH: "HEALTH",
|
|
19
|
+
DEFAULT: "DEFAULT",
|
|
20
|
+
GROCERY: "GROCERY",
|
|
21
|
+
PASTE: "PASTE",
|
|
22
|
+
ORANGE: "ORANGE",
|
|
23
|
+
GOLD: "GOLD",
|
|
24
|
+
BLUISH: "BLUISH",
|
|
25
|
+
GREEN: "GREEN",
|
|
26
|
+
YELLOW: "YELLOW",
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const breakpoints = {
|
|
30
|
+
values: {
|
|
31
|
+
xs: 0,
|
|
32
|
+
sm: 600,
|
|
33
|
+
md: 960,
|
|
34
|
+
lg: 1280,
|
|
35
|
+
xl: 1600,
|
|
36
|
+
xxl: 1920,
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
WE CREATED MULTIPLE THEME OPTIONS FOR DIFFERENT SHOP VARIATION.
|
|
42
|
+
|
|
43
|
+
YOU CAN JUST KEEP [THEMES.DEFAULT] AND REMOVE OTHER THEME OPTIONS.
|
|
44
|
+
*/
|
|
45
|
+
const themesOptionList = {
|
|
46
|
+
[THEMES.DEFAULT]: {
|
|
47
|
+
typography,
|
|
48
|
+
components,
|
|
49
|
+
breakpoints,
|
|
50
|
+
palette: { primary: { ...primary, light: primary[100] }, ...themeColors },
|
|
51
|
+
},
|
|
52
|
+
[THEMES.GROCERY]: {
|
|
53
|
+
typography,
|
|
54
|
+
components,
|
|
55
|
+
breakpoints,
|
|
56
|
+
palette: { primary: { ...primary, light: primary[100] }, ...themeColors },
|
|
57
|
+
},
|
|
58
|
+
[THEMES.PASTE]: {
|
|
59
|
+
typography,
|
|
60
|
+
components,
|
|
61
|
+
breakpoints,
|
|
62
|
+
palette: { primary: { ...paste, light: paste[100] }, ...themeColors },
|
|
63
|
+
},
|
|
64
|
+
[THEMES.HEALTH]: {
|
|
65
|
+
typography,
|
|
66
|
+
components,
|
|
67
|
+
breakpoints,
|
|
68
|
+
palette: { primary: { ...blue, light: blue[100] }, ...themeColors },
|
|
69
|
+
},
|
|
70
|
+
[THEMES.GIFT]: {
|
|
71
|
+
typography,
|
|
72
|
+
components,
|
|
73
|
+
breakpoints,
|
|
74
|
+
palette: { primary: { ...marron, light: marron[100] }, ...themeColors },
|
|
75
|
+
},
|
|
76
|
+
[THEMES.ORANGE]: {
|
|
77
|
+
typography,
|
|
78
|
+
components,
|
|
79
|
+
breakpoints,
|
|
80
|
+
palette: { primary: { ...orange }, ...themeColors },
|
|
81
|
+
},
|
|
82
|
+
[THEMES.GOLD]: {
|
|
83
|
+
typography,
|
|
84
|
+
components,
|
|
85
|
+
breakpoints,
|
|
86
|
+
palette: { primary: { ...gold }, ...themeColors },
|
|
87
|
+
},
|
|
88
|
+
[THEMES.BLUISH]: {
|
|
89
|
+
typography,
|
|
90
|
+
components,
|
|
91
|
+
breakpoints,
|
|
92
|
+
palette: { primary: { ...bluish }, ...themeColors },
|
|
93
|
+
},
|
|
94
|
+
[THEMES.GREEN]: {
|
|
95
|
+
typography,
|
|
96
|
+
components,
|
|
97
|
+
breakpoints,
|
|
98
|
+
palette: { primary: { ...success }, ...themeColors },
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
[THEMES.YELLOW]: {
|
|
102
|
+
typography,
|
|
103
|
+
components,
|
|
104
|
+
breakpoints,
|
|
105
|
+
palette: { primary: { ...warning }, ...themeColors },
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const themeOptions = (pathname: string) => {
|
|
110
|
+
let themeOption;
|
|
111
|
+
|
|
112
|
+
const path = pathname || "/"; // Fallback to root if null
|
|
113
|
+
/*
|
|
114
|
+
YOU CAN ALSO REMOVE updateTheme function
|
|
115
|
+
AND FOLLOWING ENTIRE switch case BLOCK.
|
|
116
|
+
*/
|
|
117
|
+
const updateTheme = (themeName: string) => {
|
|
118
|
+
themeOption = themesOptionList[themeName];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
switch (path) {
|
|
122
|
+
case "/":
|
|
123
|
+
updateTheme(THEMES.DEFAULT);
|
|
124
|
+
break;
|
|
125
|
+
|
|
126
|
+
case "/furniture-1":
|
|
127
|
+
updateTheme(THEMES.PASTE);
|
|
128
|
+
break;
|
|
129
|
+
|
|
130
|
+
case "/medical":
|
|
131
|
+
updateTheme(THEMES.PASTE);
|
|
132
|
+
break;
|
|
133
|
+
|
|
134
|
+
case "/furniture-2":
|
|
135
|
+
updateTheme(THEMES.ORANGE);
|
|
136
|
+
break;
|
|
137
|
+
|
|
138
|
+
case "/furniture-3":
|
|
139
|
+
updateTheme(THEMES.GOLD);
|
|
140
|
+
break;
|
|
141
|
+
|
|
142
|
+
case "/health-beauty":
|
|
143
|
+
updateTheme(THEMES.HEALTH);
|
|
144
|
+
break;
|
|
145
|
+
|
|
146
|
+
case "/gift-shop":
|
|
147
|
+
updateTheme(THEMES.GIFT);
|
|
148
|
+
break;
|
|
149
|
+
|
|
150
|
+
default:
|
|
151
|
+
if (path.startsWith("/grocery-4")) {
|
|
152
|
+
themeOption = themesOptionList[THEMES.GREEN];
|
|
153
|
+
} else if (path.startsWith("/gadget-3")) {
|
|
154
|
+
themeOption = themesOptionList[THEMES.HEALTH];
|
|
155
|
+
} else if (path.startsWith("/admin") || path.startsWith("/vendor")) {
|
|
156
|
+
themeOption = themesOptionList[THEMES.HEALTH];
|
|
157
|
+
} else {
|
|
158
|
+
themeOption = themesOptionList[THEMES.DEFAULT];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
/*
|
|
164
|
+
IF YOU REMOVE THE switch case, YOU NEED TO ASSIGN VALUE TO themeOptions
|
|
165
|
+
E.G. themeOption = themesOptions[THEMES.DEFAULT];
|
|
166
|
+
*/
|
|
167
|
+
// themeOption = themesOptions[THEMES.DEFAULT];
|
|
168
|
+
|
|
169
|
+
return themeOption;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export default themeOptions;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { usePathname } from "next/navigation";
|
|
5
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
6
|
+
import MuiThemeProvider from "@mui/material/styles/ThemeProvider";
|
|
7
|
+
import responsiveFontSizes from "@mui/material/styles/responsiveFontSizes";
|
|
8
|
+
import createTheme, { ThemeOptions } from "@mui/material/styles/createTheme";
|
|
9
|
+
import merge from "lodash/merge";
|
|
10
|
+
import customThemeOptions from "./theme-options";
|
|
11
|
+
import NextAppDirEmotionCacheProvider from "./emotion-cache";
|
|
12
|
+
import { ThemeItem } from "@evenicanpm/storefront-core/src/api-manager/datasources/e4/graphqlRequestSdk";
|
|
13
|
+
|
|
14
|
+
const ThemeProvider = ({
|
|
15
|
+
children,
|
|
16
|
+
baseTheme,
|
|
17
|
+
}: {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
baseTheme: ThemeItem | null | undefined;
|
|
20
|
+
}) => {
|
|
21
|
+
const pathname = usePathname();
|
|
22
|
+
const themeOptions = customThemeOptions(pathname);
|
|
23
|
+
const mergedThemeOptions = merge({}, { ...themeOptions, ...baseTheme });
|
|
24
|
+
let theme = createTheme(mergedThemeOptions as ThemeOptions);
|
|
25
|
+
|
|
26
|
+
theme = responsiveFontSizes(theme);
|
|
27
|
+
|
|
28
|
+
// theme shadows
|
|
29
|
+
theme.shadows[1] = "0px 1px 3px rgba(3, 0, 71, 0.09)";
|
|
30
|
+
theme.shadows[2] = "0px 4px 16px rgba(43, 52, 69, 0.1)";
|
|
31
|
+
theme.shadows[3] = "0px 8px 45px rgba(3, 0, 71, 0.09)";
|
|
32
|
+
theme.shadows[4] = "0px 0px 28px rgba(3, 0, 71, 0.01)";
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<NextAppDirEmotionCacheProvider options={{ key: "css" }}>
|
|
36
|
+
<MuiThemeProvider theme={theme}>
|
|
37
|
+
<CssBaseline />
|
|
38
|
+
{children}
|
|
39
|
+
</MuiThemeProvider>
|
|
40
|
+
</NextAppDirEmotionCacheProvider>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default ThemeProvider;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Open_Sans } from "next/font/google";
|
|
2
|
+
export const fontSize = 14;
|
|
3
|
+
|
|
4
|
+
// const roboto = Roboto({
|
|
5
|
+
// weight: ["400", "500", "700", "900"],
|
|
6
|
+
// subsets: ["latin-ext"],
|
|
7
|
+
// variable: "--font-roboto",
|
|
8
|
+
// });
|
|
9
|
+
|
|
10
|
+
const open_sans = Open_Sans({
|
|
11
|
+
weight: ["400", "500", "700"],
|
|
12
|
+
subsets: ["latin-ext"],
|
|
13
|
+
variable: "--font-open_sans",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const typography = {
|
|
17
|
+
fontSize,
|
|
18
|
+
htmlFontSize: 16,
|
|
19
|
+
fontFamily: open_sans.style.fontFamily,
|
|
20
|
+
body1: { fontSize },
|
|
21
|
+
body2: { fontSize },
|
|
22
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const classes = () => {
|
|
2
|
+
const obj: Record<string, unknown> = {};
|
|
3
|
+
|
|
4
|
+
for (let i = 1; i < 11; i++) {
|
|
5
|
+
// PADDING
|
|
6
|
+
obj[`.p-${i}`] = { padding: i + "rem" };
|
|
7
|
+
obj[`.pt-${i}`] = { paddingTop: i + "rem" };
|
|
8
|
+
obj[`.pb-${i}`] = { paddingBottom: i + "rem" };
|
|
9
|
+
|
|
10
|
+
// MARGIN
|
|
11
|
+
obj[`.m-${i}`] = { margin: i + "rem" };
|
|
12
|
+
obj[`.mt-${i}`] = { marginTop: i + "rem" };
|
|
13
|
+
obj[`.mb-${i}`] = { marginBottom: i + "rem" };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return obj;
|
|
17
|
+
};
|
package/tsconfig.json
CHANGED
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
"moduleResolution": "node",
|
|
11
11
|
"resolveJsonModule": true,
|
|
12
12
|
"outDir": "./dist",
|
|
13
|
-
"jsx": "preserve",
|
|
14
13
|
"baseUrl": "./",
|
|
14
|
+
"jsx": "preserve",
|
|
15
|
+
"typeRoots": ["../../../../storefront/node_modules/@types"],
|
|
15
16
|
"paths": {
|
|
17
|
+
"*": ["../../../../storefront/node_modules/*"],
|
|
16
18
|
"@/lib/*": ["src/lib/*"],
|
|
17
19
|
"@/api-manager/*": ["src/api-manager/*"],
|
|
18
20
|
"@/auth/*": ["src/auth/*"],
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use server";
|
|
2
|
-
import { cookies } from "next/headers";
|
|
3
|
-
|
|
4
|
-
const getCartCookie = async () => (await cookies()).get("cart_cookie")?.value;
|
|
5
|
-
|
|
6
|
-
const setCartCookie = async (cartId: string) => {
|
|
7
|
-
(await cookies()).set("cart_cookie", cartId);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const deleteCartCookie = async () => {
|
|
11
|
-
(await cookies()).delete("cart_cookie");
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { getCartCookie, setCartCookie, deleteCartCookie };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import IconButton from "@mui/material/IconButton";
|
|
2
|
-
// MUI ICON COMPONENTS
|
|
3
|
-
import Favorite from "@mui/icons-material/Favorite";
|
|
4
|
-
import RemoveRedEye from "@mui/icons-material/RemoveRedEye";
|
|
5
|
-
import FavoriteBorder from "@mui/icons-material/FavoriteBorder";
|
|
6
|
-
// STYLED COMPONENTS
|
|
7
|
-
import { HoverIconWrapper } from "@evenicanpm/storefront-core/src/components-v2/product-cards/product-card/styles/index";
|
|
8
|
-
|
|
9
|
-
// ==============================================================
|
|
10
|
-
interface Props {
|
|
11
|
-
isFavorite: boolean;
|
|
12
|
-
toggleView: () => void;
|
|
13
|
-
toggleFavorite: () => void;
|
|
14
|
-
}
|
|
15
|
-
// ==============================================================
|
|
16
|
-
|
|
17
|
-
export default function HoverActions({
|
|
18
|
-
isFavorite,
|
|
19
|
-
toggleFavorite,
|
|
20
|
-
toggleView,
|
|
21
|
-
}: Props) {
|
|
22
|
-
return (
|
|
23
|
-
<HoverIconWrapper className="hover-box">
|
|
24
|
-
<IconButton onClick={toggleView}>
|
|
25
|
-
<RemoveRedEye color="disabled" fontSize="small" />
|
|
26
|
-
</IconButton>
|
|
27
|
-
|
|
28
|
-
<IconButton onClick={toggleFavorite}>
|
|
29
|
-
{isFavorite ? (
|
|
30
|
-
<Favorite color="primary" fontSize="small" />
|
|
31
|
-
) : (
|
|
32
|
-
<FavoriteBorder fontSize="small" color="disabled" />
|
|
33
|
-
)}
|
|
34
|
-
</IconButton>
|
|
35
|
-
</HoverIconWrapper>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Fragment } from "react";
|
|
2
|
-
import Button from "@mui/material/Button";
|
|
3
|
-
// MUI ICON COMPONENTS
|
|
4
|
-
import Add from "@mui/icons-material/Add";
|
|
5
|
-
import Remove from "@mui/icons-material/Remove";
|
|
6
|
-
// GLOBAL CUSTOM COMPONENTS
|
|
7
|
-
import { FlexBox } from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
8
|
-
import { Paragraph } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
quantity: number;
|
|
12
|
-
handleDecrement: () => void;
|
|
13
|
-
handleIncrement: () => void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default function QuantityButtons(props: Props) {
|
|
17
|
-
const { quantity, handleDecrement, handleIncrement } = props || {};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<FlexBox
|
|
21
|
-
width="30px"
|
|
22
|
-
alignItems="center"
|
|
23
|
-
className="add-cart"
|
|
24
|
-
flexDirection="column-reverse"
|
|
25
|
-
justifyContent={quantity ? "space-between" : "flex-start"}
|
|
26
|
-
>
|
|
27
|
-
<Button
|
|
28
|
-
color="primary"
|
|
29
|
-
variant="outlined"
|
|
30
|
-
onClick={handleIncrement}
|
|
31
|
-
sx={{ padding: "3px" }}
|
|
32
|
-
>
|
|
33
|
-
<Add fontSize="small" />
|
|
34
|
-
</Button>
|
|
35
|
-
|
|
36
|
-
{quantity ? (
|
|
37
|
-
<Fragment>
|
|
38
|
-
<Paragraph color="text.primary" fontWeight="600">
|
|
39
|
-
{quantity}
|
|
40
|
-
</Paragraph>
|
|
41
|
-
|
|
42
|
-
<Button
|
|
43
|
-
color="primary"
|
|
44
|
-
variant="outlined"
|
|
45
|
-
onClick={handleDecrement}
|
|
46
|
-
sx={{ padding: "3px" }}
|
|
47
|
-
>
|
|
48
|
-
<Remove fontSize="small" />
|
|
49
|
-
</Button>
|
|
50
|
-
</Fragment>
|
|
51
|
-
) : null}
|
|
52
|
-
</FlexBox>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import Button from "@mui/material/Button";
|
|
2
|
-
// MUI ICON COMPONENTS
|
|
3
|
-
import Add from "@mui/icons-material/Add";
|
|
4
|
-
import Remove from "@mui/icons-material/Remove";
|
|
5
|
-
// GLOBAL CUSTOM COMPONENTS
|
|
6
|
-
import { H5 } from "@evenicanpm/storefront-core/src/components-v2/Typography";
|
|
7
|
-
import {
|
|
8
|
-
FlexBetween,
|
|
9
|
-
FlexBox,
|
|
10
|
-
} from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
11
|
-
|
|
12
|
-
// ==============================================================
|
|
13
|
-
interface Props {
|
|
14
|
-
quantity: number;
|
|
15
|
-
handleDecrement: () => void;
|
|
16
|
-
handleIncrement: () => void;
|
|
17
|
-
}
|
|
18
|
-
// ==============================================================
|
|
19
|
-
|
|
20
|
-
export default function AddToCartButton({
|
|
21
|
-
quantity,
|
|
22
|
-
handleDecrement,
|
|
23
|
-
handleIncrement,
|
|
24
|
-
}: Props) {
|
|
25
|
-
return (
|
|
26
|
-
<FlexBox mt={1} flexShrink={0}>
|
|
27
|
-
{quantity ? (
|
|
28
|
-
<FlexBetween>
|
|
29
|
-
<Button
|
|
30
|
-
color="primary"
|
|
31
|
-
variant="contained"
|
|
32
|
-
sx={{ padding: 0.5, minHeight: 0 }}
|
|
33
|
-
onClick={handleIncrement}
|
|
34
|
-
>
|
|
35
|
-
<Add fontSize="small" />
|
|
36
|
-
</Button>
|
|
37
|
-
|
|
38
|
-
<H5 fontWeight="600" fontSize="15px" mx={1.5}>
|
|
39
|
-
{quantity}
|
|
40
|
-
</H5>
|
|
41
|
-
|
|
42
|
-
<Button
|
|
43
|
-
color="primary"
|
|
44
|
-
variant="contained"
|
|
45
|
-
sx={{ padding: 0.5, minHeight: 0 }}
|
|
46
|
-
onClick={handleDecrement}
|
|
47
|
-
>
|
|
48
|
-
<Remove fontSize="small" />
|
|
49
|
-
</Button>
|
|
50
|
-
</FlexBetween>
|
|
51
|
-
) : (
|
|
52
|
-
<Button
|
|
53
|
-
color="primary"
|
|
54
|
-
variant="contained"
|
|
55
|
-
onClick={handleIncrement}
|
|
56
|
-
sx={{ padding: 0.5, minHeight: 0 }}
|
|
57
|
-
>
|
|
58
|
-
<Add fontSize="small" />
|
|
59
|
-
</Button>
|
|
60
|
-
)}
|
|
61
|
-
</FlexBox>
|
|
62
|
-
);
|
|
63
|
-
}
|
package/src/components-v2/product-cards/product-card-plp-list/components/favorite-button.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import IconButton from "@mui/material/IconButton";
|
|
2
|
-
// MUI ICON COMPONENTS
|
|
3
|
-
import Favorite from "@mui/icons-material/Favorite";
|
|
4
|
-
import FavoriteBorder from "@mui/icons-material/FavoriteBorder";
|
|
5
|
-
|
|
6
|
-
// ==============================================================
|
|
7
|
-
interface Props {
|
|
8
|
-
isFavorite: boolean;
|
|
9
|
-
toggleFavorite: () => void;
|
|
10
|
-
}
|
|
11
|
-
// ==============================================================
|
|
12
|
-
|
|
13
|
-
export default function FavoriteButton({ isFavorite, toggleFavorite }: Props) {
|
|
14
|
-
return (
|
|
15
|
-
<IconButton
|
|
16
|
-
size="small"
|
|
17
|
-
onClick={toggleFavorite}
|
|
18
|
-
sx={{ position: "absolute", top: 15, right: 15, zIndex: 1 }}
|
|
19
|
-
>
|
|
20
|
-
{isFavorite ? (
|
|
21
|
-
<Favorite color="primary" fontSize="small" />
|
|
22
|
-
) : (
|
|
23
|
-
<FavoriteBorder fontSize="small" />
|
|
24
|
-
)}
|
|
25
|
-
</IconButton>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import getCart from "@/services/cart/queries/get-cart";
|
|
2
|
-
import { useCallback, useState } from "react";
|
|
3
|
-
import { useSnackbar } from "notistack";
|
|
4
|
-
|
|
5
|
-
export default function useProduct(slug: string) {
|
|
6
|
-
const { data: cart } = getCart.useData();
|
|
7
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
8
|
-
const [openModal, setOpenModal] = useState(false);
|
|
9
|
-
const [isFavorite, setIsFavorite] = useState(false);
|
|
10
|
-
|
|
11
|
-
const cartItem = cart?.CartLines?.find(
|
|
12
|
-
(cartLine) => String(cartLine.Product?.RecordId) === slug,
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const toggleFavorite = useCallback(() => setIsFavorite((fav) => !fav), []);
|
|
16
|
-
const toggleDialog = useCallback(() => setOpenModal((open) => !open), []);
|
|
17
|
-
|
|
18
|
-
const handleCartAmountChange = (type?: "remove") => {
|
|
19
|
-
// TODO Febraury 25, 2025: Implement this function
|
|
20
|
-
//dispatch({ type: "CHANGE_CART_AMOUNT", payload: product });
|
|
21
|
-
// SHOW ALERT PRODUCT ADDED OR REMOVE
|
|
22
|
-
if (type === "remove")
|
|
23
|
-
enqueueSnackbar("Remove from Cart", { variant: "error" });
|
|
24
|
-
else enqueueSnackbar("Added to Cart", { variant: "success" });
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
cartItem,
|
|
29
|
-
openModal,
|
|
30
|
-
isFavorite,
|
|
31
|
-
toggleDialog,
|
|
32
|
-
toggleFavorite,
|
|
33
|
-
handleCartAmountChange,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Fragment, ReactNode } from "react";
|
|
2
|
-
import Grid from "@mui/material/Grid2";
|
|
3
|
-
// GLOBAL CUSTOM COMPONENTS
|
|
4
|
-
import { FlexBetween } from "@evenicanpm/storefront-core/src/components-v2/flex-box/index";
|
|
5
|
-
import ProductCardPlp from "@evenicanpm/storefront-core/src/components-v2/product-cards/product-card-plp/product-card";
|
|
6
|
-
// DATA MODEL
|
|
7
|
-
import { ProductSearchResult as Product } from "@msdyn365-commerce/retail-proxy";
|
|
8
|
-
import { ProductPrice } from "@/api-manager/schemas/product.schema";
|
|
9
|
-
|
|
10
|
-
// ========================================================
|
|
11
|
-
type Props = {
|
|
12
|
-
products: Product[];
|
|
13
|
-
pagination?: ReactNode;
|
|
14
|
-
productPrices?: ProductPrice[];
|
|
15
|
-
};
|
|
16
|
-
// ========================================================
|
|
17
|
-
|
|
18
|
-
export default function ProductsGridView({
|
|
19
|
-
products,
|
|
20
|
-
pagination,
|
|
21
|
-
productPrices,
|
|
22
|
-
}: Props) {
|
|
23
|
-
return (
|
|
24
|
-
<Fragment>
|
|
25
|
-
<Grid container spacing={3}>
|
|
26
|
-
{products.map((item: Product) => {
|
|
27
|
-
const matchingPrice = productPrices?.find(
|
|
28
|
-
(price) => price.ProductId === item.RecordId,
|
|
29
|
-
);
|
|
30
|
-
return (
|
|
31
|
-
<Grid size={{ lg: 4, sm: 6, xs: 12 }} key={item.ItemId}>
|
|
32
|
-
<ProductCardPlp
|
|
33
|
-
key={item.RecordId}
|
|
34
|
-
product={{
|
|
35
|
-
title: item.Name ?? "",
|
|
36
|
-
slug: item.ItemId ?? "",
|
|
37
|
-
price: matchingPrice?.CustomerContextualPrice ?? 0,
|
|
38
|
-
imgUrl: item.PrimaryImageUrl ?? "",
|
|
39
|
-
rating: item.TotalRatings ?? 0,
|
|
40
|
-
discount: 0, // Need to get discount info for product.
|
|
41
|
-
id: item.RecordId,
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
<ProductCardPlp.Image />
|
|
45
|
-
<ProductCardPlp.Body>
|
|
46
|
-
<ProductCardPlp.Info>
|
|
47
|
-
<ProductCardPlp.Title />
|
|
48
|
-
<ProductCardPlp.Rating />
|
|
49
|
-
<ProductCardPlp.Price />
|
|
50
|
-
</ProductCardPlp.Info>
|
|
51
|
-
{/* <ProductCardPlp.Actions>
|
|
52
|
-
<ProductCardPlp.QuantityButtons />
|
|
53
|
-
</ProductCardPlp.Actions> */}
|
|
54
|
-
</ProductCardPlp.Body>
|
|
55
|
-
</ProductCardPlp>
|
|
56
|
-
</Grid>
|
|
57
|
-
);
|
|
58
|
-
})}
|
|
59
|
-
</Grid>
|
|
60
|
-
<FlexBetween flexWrap="wrap" mt={6}>
|
|
61
|
-
{pagination}
|
|
62
|
-
</FlexBetween>
|
|
63
|
-
</Fragment>
|
|
64
|
-
);
|
|
65
|
-
}
|