@evenicanpm/storefront-core 1.0.3 → 1.0.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/docs.tsconfig.json +35 -0
- package/package.json +6 -3
- package/src/api-manager/schemas/product.schema.ts +0 -1
- package/src/api-manager/services/create-query.ts +10 -0
- package/src/api-manager/services/product/queries/get-product-availability.ts +1 -1
- package/src/api-manager/services/user/mutations/add-to-wishlist.ts +23 -3
- package/src/api-manager/services/user/mutations/remove-from-wishlist.ts +23 -0
- package/src/cms/blocks/Components/CategoryCarousel/index.tsx +6 -7
- package/src/cms/blocks/Components/HeroCarousel/index.tsx +25 -19
- package/src/cms/blocks/Components/ProductCarousel/index.tsx +44 -38
- package/src/cms/blocks/Components/ProductSectionFullWidth/index.tsx +7 -3
- package/src/cms/blocks/Components/shared/product-grid.tsx +38 -23
- package/src/components/_components/wishlist/add-to-wishlist-dialog.tsx +1 -1
- package/src/components/_components/wishlist/remove-from-wishlist-dialog.tsx +1 -1
- package/src/components/_components/wishlist-modal/add-to-wishlist-dialog.tsx +1 -1
- package/src/components/_components/wishlist-modal/remove-from-wishlist-dialog.tsx +1 -1
- package/src/components-v2/carousel/carousel.tsx +69 -35
- package/src/components-v2/carousel/components/carousel-arrows.tsx +40 -46
- package/src/components-v2/carousel/components/carousel-dots.tsx +10 -13
- package/src/components-v2/carousel/index.ts +0 -2
- package/src/components-v2/carousel-cards/carousel-card-1/carousel-card-1.tsx +68 -49
- package/src/components-v2/categories/category-list/category-list.tsx +83 -41
- package/src/components-v2/categories/category-list/styles.ts +7 -1
- package/src/components-v2/categories/category-menu.tsx +2 -0
- package/src/components-v2/categories/mega-menu/banner.tsx +68 -37
- package/src/components-v2/categories/mega-menu/column-list.tsx +59 -52
- package/src/components-v2/categories/mega-menu/mega-menu-1.tsx +19 -1
- package/src/components-v2/categories/mega-menu/mega-menu-2.tsx +32 -2
- package/src/components-v2/header/components/mobile-header.tsx +119 -46
- package/src/components-v2/header/components/user.tsx +163 -117
- package/src/components-v2/header/header.tsx +62 -42
- package/src/components-v2/header/sticky-header.tsx +34 -2
- package/src/components-v2/mini-cart/components/bottom-actions.tsx +71 -17
- package/src/components-v2/mini-cart/components/cart-item.tsx +159 -101
- package/src/components-v2/mini-cart/components/empty-view.tsx +59 -19
- package/src/components-v2/mini-cart/components/top-header.tsx +61 -22
- package/src/components-v2/mini-cart/mini-cart-trigger.tsx +99 -0
- package/src/components-v2/mini-cart/mini-cart.tsx +111 -43
- package/src/components-v2/mobile-navigation/mobile-navigation-bar.tsx +93 -48
- package/src/components-v2/navbar/categories.tsx +70 -16
- package/src/components-v2/navbar/category-based-menu/category-based-menu.tsx +135 -41
- package/src/components-v2/navbar/mega-menu/mega-menu.tsx +115 -48
- package/src/components-v2/navbar/mobile-menu/mobile-menu.test.tsx +111 -0
- package/src/components-v2/navbar/mobile-menu/mobile-menu.tsx +127 -56
- package/src/components-v2/navbar/nav-list/nav-list.tsx +125 -103
- package/src/components-v2/navbar/navbar.tsx +72 -20
- package/src/components-v2/product-cards/{product-card-1 → product-card}/components/quantity-buttons.tsx +1 -1
- package/src/components-v2/product-cards/product-card/product-card.tsx +410 -0
- package/src/components-v2/product-cards/{product-card-1 → product-card}/styles/index.ts +6 -0
- package/src/components-v2/product-cards/product-card-plp/product-card.tsx +161 -0
- package/src/components-v2/product-cards/product-card-plp-list/index.ts +1 -0
- package/src/components-v2/product-cards/product-card-plp-list/product-card.tsx +219 -0
- package/src/components-v2/product-cards/product-card-search/product-card.tsx +166 -0
- package/src/components-v2/product-dialog/compound/product-dialog.tsx +225 -0
- package/src/components-v2/product-dialog/index.tsx +29 -0
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group-error.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group-label.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group-list-chip.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group-list.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions-group.tsx +1 -1
- package/src/components-v2/product-dimensions/{components → compound}/dimensions.tsx +0 -3
- package/src/components-v2/product-dimensions/index.tsx +1 -1
- package/src/components-v2/product-quantity-buttons/compound/quantity-buttons-root.tsx +181 -0
- package/src/components-v2/product-quantity-buttons/index.tsx +22 -0
- package/src/components-v2/product-quantity-variants/index.tsx +90 -0
- package/src/components-v2/products-view/compound/context.ts +25 -0
- package/src/components-v2/products-view/compound/products-grid-view.tsx +109 -0
- package/src/components-v2/products-view/compound/products-list-view.tsx +98 -0
- package/src/components-v2/products-view/compound/types.ts +12 -0
- package/src/components-v2/products-view/index.tsx +45 -0
- package/src/components-v2/products-view/products-grid-view.tsx +24 -11
- package/src/components-v2/products-view/products-list-view.tsx +29 -12
- package/src/components-v2/search-bar/compound/context.ts +31 -0
- package/src/components-v2/search-bar/compound/results-item-lg.tsx +43 -0
- package/src/components-v2/search-bar/compound/results-item-sm.tsx +48 -0
- package/src/components-v2/search-bar/compound/results-suspense.tsx +49 -0
- package/src/components-v2/search-bar/compound/results.tsx +42 -0
- package/src/components-v2/search-bar/compound/search-bar-root.tsx +64 -0
- package/src/components-v2/search-bar/compound/textfield-adornment-button.tsx +22 -0
- package/src/components-v2/{search-box/components/category-dropdown.tsx → search-bar/compound/textfield-adornment-category.tsx} +29 -7
- package/src/components-v2/search-bar/compound/textfield-adornment-search-icon.tsx +34 -0
- package/src/components-v2/search-bar/compound/textfield.tsx +58 -0
- package/src/components-v2/search-bar/hooks/use-click-outside.ts +20 -0
- package/src/components-v2/search-bar/hooks/use-search.ts +63 -0
- package/src/components-v2/search-bar/index.tsx +36 -0
- package/src/components-v2/{search-box → search-bar}/styles/index.ts +5 -3
- package/src/components-v2/search-bar/utils/findCategoryNameById.ts +18 -0
- package/src/components-v2/section/compound/section-header.tsx +63 -0
- package/src/components-v2/section/compound/section.tsx +26 -0
- package/src/components-v2/section/index.ts +1 -0
- package/src/components-v2/side-nav/side-nav.tsx +4 -5
- package/src/components-v2/sticky/index.ts +1 -1
- package/src/components-v2/{wishlist-modal → wishlist-dialogs/add-to-wishlist}/add-to-wishlist-button.tsx +1 -1
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-bottom-ui.tsx +35 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-dialog.tsx +79 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/add-to-wishlist-list.tsx +41 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/context.ts +29 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-header.tsx +74 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/compound/wishlist-dialog-item.tsx +82 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/hooks/use-add-to-wishlist.ts +152 -0
- package/src/components-v2/wishlist-dialogs/add-to-wishlist/index.tsx +39 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/context.ts +2 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-bottom-ui.tsx +42 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-dialog.tsx +92 -0
- package/src/components-v2/wishlist-dialogs/create-wishlist/compound/create-wishlist-form.tsx +96 -0
- package/src/components-v2/{wishlist/components → wishlist-dialogs/create-wishlist}/create-wishlist-button.tsx +5 -3
- package/src/components-v2/wishlist-dialogs/create-wishlist/index.tsx +22 -0
- package/src/hooks/use-cart.ts +29 -23
- package/src/hooks/use-variants.ts +106 -53
- package/src/lib/build-detail-url.ts +2 -1
- package/src/pages/product-details/product-intro/product-intro.tsx +26 -23
- package/src/pages/product-list/quick-view-dialog-content.tsx +18 -9
- package/src/pages-v2/product-details/bopis/find-in-store-button.tsx +9 -8
- package/src/pages-v2/product-details/bopis/find-in-store-modal.tsx +2 -2
- package/src/{components-v2/shop-card → pages-v2/product-details/bopis/store-card}/shop-card.tsx +17 -48
- package/src/pages-v2/product-details/bopis/store-card/utils/convertSecondsToTime.ts +8 -0
- package/src/pages-v2/product-details/bopis/store-card/utils/getDaysResources.ts +25 -0
- package/src/pages-v2/product-details/product-intro/compound/context.ts +52 -0
- package/src/pages-v2/product-details/product-intro/compound/product-info.tsx +231 -0
- package/src/pages-v2/product-details/product-intro/compound/product-intro-images.tsx +124 -0
- package/src/pages-v2/product-details/product-intro/compound/product-intro.tsx +49 -0
- package/src/pages-v2/product-details/product-intro/compound/thumbnail-with-skeleton.tsx +28 -0
- package/src/pages-v2/product-details/product-intro/utils.ts +42 -0
- package/src/pages-v2/product-details/product-tabs.tsx +87 -21
- package/src/pages-v2/product-details/related-products.tsx +26 -12
- package/src/pages-v2/product-list/quick-view-dialog-content.tsx +17 -10
- package/typedoc.js +3 -1
- package/src/components-v2/MiniCartClient.tsx +0 -65
- package/src/components-v2/carousel-cards/carousel-card-2/carousel-card-2.tsx +0 -78
- package/src/components-v2/carousel-cards/carousel-card-2/index.ts +0 -1
- package/src/components-v2/carousel-cards/carousel-card-2/styles.ts +0 -26
- package/src/components-v2/carousel-cards/carousel-card-3/carousel-card-3.tsx +0 -37
- package/src/components-v2/carousel-cards/carousel-card-3/index.ts +0 -1
- package/src/components-v2/carousel-cards/carousel-card-3/styles.ts +0 -28
- package/src/components-v2/carousel-cards/carousel-card-4/carousel-card-4.tsx +0 -81
- package/src/components-v2/carousel-cards/carousel-card-4/index.ts +0 -1
- package/src/components-v2/carousel-cards/carousel-card-4/styles.ts +0 -27
- package/src/components-v2/category-cards/category-card-1/category-card-1.tsx +0 -21
- package/src/components-v2/category-cards/category-card-1/index.ts +0 -1
- package/src/components-v2/category-cards/category-card-1/styles.ts +0 -37
- package/src/components-v2/countdown/count-box.tsx +0 -19
- package/src/components-v2/countdown/count-down.tsx +0 -24
- package/src/components-v2/countdown/index.tsx +0 -2
- package/src/components-v2/countdown/useCountDown.ts +0 -41
- package/src/components-v2/data-table/index.ts +0 -2
- package/src/components-v2/data-table/table-header.tsx +0 -91
- package/src/components-v2/data-table/table-pagination.tsx +0 -36
- package/src/components-v2/footer/components/about-links.tsx +0 -23
- package/src/components-v2/footer/components/app-store.tsx +0 -38
- package/src/components-v2/footer/components/customer-care-links.tsx +0 -21
- package/src/components-v2/footer/components/logo.tsx +0 -23
- package/src/components-v2/footer/components/social-links.tsx +0 -43
- package/src/components-v2/footer/data/index.ts +0 -54
- package/src/components-v2/footer/footer-1.tsx +0 -62
- package/src/components-v2/footer/footer-2.tsx +0 -57
- package/src/components-v2/footer/footer-3.tsx +0 -53
- package/src/components-v2/footer/footer-4.tsx +0 -71
- package/src/components-v2/footer/index.ts +0 -4
- package/src/components-v2/footer/styles/index.ts +0 -42
- package/src/components-v2/navbar/category-based-menu/components/categories.tsx +0 -44
- package/src/components-v2/navbar/category-based-menu/components/category-item.tsx +0 -31
- package/src/components-v2/navbar/category-based-menu/components/child-categories.tsx +0 -38
- package/src/components-v2/navbar/mega-menu/category-list.tsx +0 -29
- package/src/components-v2/navbar/mobile-menu/render-levels.test.tsx +0 -71
- package/src/components-v2/navbar/mobile-menu/render-levels.tsx +0 -62
- package/src/components-v2/newsletter/index.ts +0 -1
- package/src/components-v2/newsletter/newsletter.tsx +0 -112
- package/src/components-v2/newsletter/social-icons.tsx +0 -35
- package/src/components-v2/newsletter/styles.ts +0 -65
- package/src/components-v2/page-sidenav/grocery-side-nav/components/link-item.tsx +0 -21
- package/src/components-v2/page-sidenav/grocery-side-nav/components/list-item.tsx +0 -27
- package/src/components-v2/page-sidenav/grocery-side-nav/components/nav-accordion.tsx +0 -36
- package/src/components-v2/page-sidenav/grocery-side-nav/components/render-child.tsx +0 -26
- package/src/components-v2/page-sidenav/grocery-side-nav/grocery-side-nav.tsx +0 -32
- package/src/components-v2/page-sidenav/grocery-side-nav/index.ts +0 -1
- package/src/components-v2/page-sidenav/grocery-side-nav/styles/index.ts +0 -11
- package/src/components-v2/page-sidenav/health-beauty-side-nav/components/list-item.tsx +0 -27
- package/src/components-v2/page-sidenav/health-beauty-side-nav/components/nav-accordion.tsx +0 -44
- package/src/components-v2/page-sidenav/health-beauty-side-nav/components/render-child.tsx +0 -20
- package/src/components-v2/page-sidenav/health-beauty-side-nav/health-beauty-side-nav.tsx +0 -43
- package/src/components-v2/page-sidenav/health-beauty-side-nav/index.ts +0 -1
- package/src/components-v2/page-sidenav/health-beauty-side-nav/styles/index.ts +0 -27
- package/src/components-v2/page-sidenav/side-navbar/components/list-item.tsx +0 -25
- package/src/components-v2/page-sidenav/side-navbar/components/nav-accordion.tsx +0 -46
- package/src/components-v2/page-sidenav/side-navbar/components/render-child.tsx +0 -20
- package/src/components-v2/page-sidenav/side-navbar/index.ts +0 -1
- package/src/components-v2/page-sidenav/side-navbar/side-nav-bar.tsx +0 -77
- package/src/components-v2/page-sidenav/side-navbar/styles/index.ts +0 -73
- package/src/components-v2/page-sidenav/side-navbar-2/components/button-content.tsx +0 -32
- package/src/components-v2/page-sidenav/side-navbar-2/components/sidebar-accordion.tsx +0 -66
- package/src/components-v2/page-sidenav/side-navbar-2/index.ts +0 -1
- package/src/components-v2/page-sidenav/side-navbar-2/side-navbar-2.tsx +0 -63
- package/src/components-v2/page-sidenav/side-navbar-2/styles/index.ts +0 -68
- package/src/components-v2/product-cards/product-card-1/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-1/product-card-1-wrapper.tsx +0 -304
- package/src/components-v2/product-cards/product-card-1/product-card.tsx +0 -107
- package/src/components-v2/product-cards/product-card-10/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-10/product-card.tsx +0 -128
- package/src/components-v2/product-cards/product-card-10/styles/index.ts +0 -38
- package/src/components-v2/product-cards/product-card-11/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-11/product-card.tsx +0 -66
- package/src/components-v2/product-cards/product-card-11/styles/index.ts +0 -16
- package/src/components-v2/product-cards/product-card-12/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-12/product-card.tsx +0 -42
- package/src/components-v2/product-cards/product-card-12/styles/index.ts +0 -16
- package/src/components-v2/product-cards/product-card-13/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-13/product-card.tsx +0 -48
- package/src/components-v2/product-cards/product-card-13/styles/index.ts +0 -25
- package/src/components-v2/product-cards/product-card-14/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-14/product-card.tsx +0 -125
- package/src/components-v2/product-cards/product-card-14/styles/index.ts +0 -40
- package/src/components-v2/product-cards/product-card-15/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-15/product-card.tsx +0 -121
- package/src/components-v2/product-cards/product-card-15/styles/index.ts +0 -57
- package/src/components-v2/product-cards/product-card-16/product-card.tsx +0 -116
- package/src/components-v2/product-cards/product-card-2/components/favorite-button.tsx +0 -29
- package/src/components-v2/product-cards/product-card-2/components/product-price.tsx +0 -26
- package/src/components-v2/product-cards/product-card-2/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-2/product-card.tsx +0 -70
- package/src/components-v2/product-cards/product-card-3/components/hover-actions.tsx +0 -83
- package/src/components-v2/product-cards/product-card-3/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-3/product-card.tsx +0 -110
- package/src/components-v2/product-cards/product-card-3/styles/index.ts +0 -89
- package/src/components-v2/product-cards/product-card-4/components/hover-actions.tsx +0 -50
- package/src/components-v2/product-cards/product-card-4/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-4/product-card.tsx +0 -128
- package/src/components-v2/product-cards/product-card-4/styles/index.ts +0 -66
- package/src/components-v2/product-cards/product-card-5/components/button-actions.tsx +0 -49
- package/src/components-v2/product-cards/product-card-5/components/hover-actions.tsx +0 -50
- package/src/components-v2/product-cards/product-card-5/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-5/product-card.tsx +0 -137
- package/src/components-v2/product-cards/product-card-5/styles/index.ts +0 -94
- package/src/components-v2/product-cards/product-card-6/components/hover-actions.tsx +0 -50
- package/src/components-v2/product-cards/product-card-6/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-6/product-card.tsx +0 -121
- package/src/components-v2/product-cards/product-card-6/styles/index.ts +0 -63
- package/src/components-v2/product-cards/product-card-7/components/product-status.tsx +0 -18
- package/src/components-v2/product-cards/product-card-7/components/quantity-buttons.tsx +0 -47
- package/src/components-v2/product-cards/product-card-7/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-7/product-card.tsx +0 -139
- package/src/components-v2/product-cards/product-card-7/styles/index.ts +0 -98
- package/src/components-v2/product-cards/product-card-8/product-card.tsx +0 -151
- package/src/components-v2/product-cards/product-card-9/index.ts +0 -1
- package/src/components-v2/product-cards/product-card-9/product-card.tsx +0 -169
- package/src/components-v2/product-cards/product-card-wishlist/components/hover-actions.tsx +0 -37
- package/src/components-v2/product-cards/product-card-wishlist/product-card.tsx +0 -118
- package/src/components-v2/product-cards/product-card-wishlist/styles/index.ts +0 -53
- package/src/components-v2/product-quantity-buttons/product-quantity-buttons.tsx +0 -88
- package/src/components-v2/products-view/product-view-dialog.tsx +0 -218
- package/src/components-v2/search-box/__test__/search-input-category.test.tsx +0 -110
- package/src/components-v2/search-box/__test__/search-input.test.tsx +0 -137
- package/src/components-v2/search-box/__test__/search-results.json +0 -165
- package/src/components-v2/search-box/components/search-result.tsx +0 -86
- package/src/components-v2/search-box/hooks/use-search.ts +0 -63
- package/src/components-v2/search-box/index.ts +0 -2
- package/src/components-v2/search-box/search-input-category.test.tsx +0 -110
- package/src/components-v2/search-box/search-input-category.tsx +0 -203
- package/src/components-v2/search-box/search-input.test.tsx +0 -41
- package/src/components-v2/search-box/search-input.tsx +0 -66
- package/src/components-v2/section-header/index.ts +0 -2
- package/src/components-v2/section-header/section-creator.tsx +0 -29
- package/src/components-v2/section-header/section-header.tsx +0 -44
- package/src/components-v2/service-cards/icon-component.tsx +0 -18
- package/src/components-v2/service-cards/service-card-1/index.ts +0 -1
- package/src/components-v2/service-cards/service-card-1/service-card-1.tsx +0 -42
- package/src/components-v2/service-cards/service-card-2/index.ts +0 -1
- package/src/components-v2/service-cards/service-card-2/service-card-2.tsx +0 -37
- package/src/components-v2/service-cards/service-card-3/index.ts +0 -1
- package/src/components-v2/service-cards/service-card-3/service-card-3.tsx +0 -28
- package/src/components-v2/service-cards/service-card-3/styles.ts +0 -23
- package/src/components-v2/settings/index.ts +0 -1
- package/src/components-v2/settings/setting.tsx +0 -141
- package/src/components-v2/settings/styles.ts +0 -57
- package/src/components-v2/sticky-wrapper/index.ts +0 -1
- package/src/components-v2/sticky-wrapper/sticky-wrapper.tsx +0 -21
- package/src/components-v2/sticky-wrapper/styles.ts +0 -25
- package/src/components-v2/stories/story-content/index.ts +0 -1
- package/src/components-v2/stories/story-content/story-content.tsx +0 -28
- package/src/components-v2/stories/story-content/styles.ts +0 -22
- package/src/components-v2/stories/story-item/index.ts +0 -1
- package/src/components-v2/stories/story-item/story-item.tsx +0 -24
- package/src/components-v2/stories/story-item/styles.ts +0 -11
- package/src/components-v2/stories/story-viewer/index.ts +0 -1
- package/src/components-v2/stories/story-viewer/story-viewer.tsx +0 -44
- package/src/components-v2/stories/story-viewer/styles.ts +0 -15
- package/src/components-v2/subscribe-input/index.ts +0 -1
- package/src/components-v2/subscribe-input/styles.ts +0 -14
- package/src/components-v2/subscribe-input/subscribe-input.tsx +0 -43
- package/src/components-v2/topbar/index.ts +0 -1
- package/src/components-v2/topbar/styles.ts +0 -55
- package/src/components-v2/topbar/top-bar.tsx +0 -115
- package/src/components-v2/wishlist/add-to-wishlist-dialog.tsx +0 -161
- package/src/components-v2/wishlist/components/create-new-list.tsx +0 -167
- package/src/components-v2/wishlist/components/dashboard-header.tsx +0 -123
- package/src/components-v2/wishlist/components/navigation.tsx +0 -87
- package/src/components-v2/wishlist/components/no-records.tsx +0 -20
- package/src/components-v2/wishlist/components/wishlist-modal-item.tsx +0 -66
- package/src/components-v2/wishlist/remove-from-wishlist-dialog.tsx +0 -175
- package/src/components-v2/wishlist-modal/TODO.md +0 -10
- package/src/components-v2/wishlist-modal/add-to-wishlist-dialog.tsx +0 -161
- package/src/components-v2/wishlist-modal/remove-from-wishlist-dialog.tsx +0 -174
- package/src/components-v2/wishlist-modal/wishlist-modal-item.tsx +0 -65
- package/src/pages-v2/product-details/product-intro/product-intro-images.tsx +0 -90
- package/src/pages-v2/product-details/product-intro/product-intro.tsx +0 -256
- /package/src/{pages-v2/account → components-v2}/no-records.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-1 → product-card}/components/hover-actions.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-16 → product-card}/index.ts +0 -0
- /package/src/components-v2/product-cards/{product-card-16 → product-card-plp}/components/quantity-buttons.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-wishlist → product-card-plp}/index.ts +0 -0
- /package/src/components-v2/product-cards/{product-card-16 → product-card-plp}/styles/index.ts +0 -0
- /package/src/components-v2/product-cards/{product-card-9 → product-card-plp-list}/components/add-to-cart.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-9 → product-card-plp-list}/components/favorite-button.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-9 → product-card-plp-list}/components/tags.tsx +0 -0
- /package/src/components-v2/product-cards/{product-card-8 → product-card-search}/index.ts +0 -0
- /package/src/components-v2/product-cards/{product-card-8 → product-card-search}/styles/index.ts +0 -0
- /package/src/components-v2/sticky/{Sticky.tsx → sticky.tsx} +0 -0
- /package/src/components-v2/{wishlist → wishlist-dialogs}/styles.ts +0 -0
- /package/src/{components-v2/shop-card → pages-v2/product-details/bopis/store-card}/index.ts +0 -0
- /package/src/{components-v2/shop-card → pages-v2/product-details/bopis/store-card}/styles.ts +0 -0
|
@@ -1,68 +1,102 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import React, { forwardRef, PropsWithChildren } from "react";
|
|
4
4
|
import { SxProps, Theme, useTheme } from "@mui/material/styles";
|
|
5
|
-
import SlickCarousel, { Settings } from "react-slick";
|
|
6
5
|
import Slider from "react-slick";
|
|
7
|
-
|
|
8
|
-
import CarouselDots from "./components/carousel-dots";
|
|
9
|
-
import CarouselArrows from "./components/carousel-arrows";
|
|
10
|
-
// SLICK CAROUSEL CSS
|
|
6
|
+
import { Settings, CustomArrowProps } from "react-slick";
|
|
11
7
|
import "slick-carousel/slick/slick.css";
|
|
12
8
|
import "slick-carousel/slick/slick-theme.css";
|
|
13
|
-
|
|
9
|
+
import { createArrows } from "./components/carousel-arrows";
|
|
10
|
+
import { createDots } from "./components/carousel-dots";
|
|
14
11
|
import { RootStyle } from "./styles/index";
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
type ArrowConfig = {
|
|
14
|
+
sx?: SxProps<Theme>;
|
|
15
|
+
// optionally allow custom components:
|
|
16
|
+
NextArrow?: React.ComponentType<CustomArrowProps & { sx?: SxProps<Theme> }>;
|
|
17
|
+
PrevArrow?: React.ComponentType<CustomArrowProps & { sx?: SxProps<Theme> }>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type DotConfig = {
|
|
18
21
|
dotColor?: string;
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
sx?: SxProps<Theme>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export interface CarouselProps
|
|
26
|
+
extends PropsWithChildren<Omit<Settings, "arrows" | "dots">> {
|
|
27
|
+
arrows?: boolean | ArrowConfig;
|
|
28
|
+
dots?: boolean | DotConfig;
|
|
29
|
+
|
|
30
|
+
// backward-compatible convenience props
|
|
21
31
|
arrowStyles?: SxProps<Theme>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
dotColor?: string;
|
|
33
|
+
dotStyles?: SxProps<Theme>;
|
|
34
|
+
|
|
35
|
+
// layout helpers
|
|
36
|
+
spaceBetween?: number;
|
|
25
37
|
height?: number;
|
|
26
|
-
autoplay?: boolean;
|
|
27
|
-
autoplaySpeed?: number;
|
|
28
38
|
}
|
|
29
|
-
// ==============================================================
|
|
30
39
|
|
|
31
|
-
const Carousel = forwardRef<Slider,
|
|
40
|
+
const Carousel = forwardRef<Slider, CarouselProps>((props, ref) => {
|
|
41
|
+
const theme = useTheme();
|
|
42
|
+
|
|
32
43
|
const {
|
|
33
|
-
dotColor,
|
|
34
44
|
children,
|
|
35
|
-
arrowStyles,
|
|
36
|
-
dots = false,
|
|
37
|
-
arrows = true,
|
|
38
|
-
slidesToShow = 4,
|
|
39
45
|
spaceBetween = 10,
|
|
40
|
-
dotStyles = { mt: 4 },
|
|
41
46
|
height = 400,
|
|
42
47
|
autoplay = false,
|
|
43
48
|
autoplaySpeed = 3000,
|
|
49
|
+
arrowStyles,
|
|
50
|
+
dotColor,
|
|
51
|
+
dotStyles,
|
|
52
|
+
arrows,
|
|
53
|
+
dots,
|
|
44
54
|
...others
|
|
45
55
|
} = props;
|
|
46
56
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
dots,
|
|
51
|
-
arrows,
|
|
52
|
-
slidesToShow,
|
|
57
|
+
// base settings from others (these come from props or react-slick Settings)
|
|
58
|
+
const baseSettings: Settings = {
|
|
59
|
+
rtl: theme.direction === "rtl",
|
|
53
60
|
autoplay,
|
|
54
61
|
autoplaySpeed,
|
|
55
|
-
rtl: theme.direction === "rtl",
|
|
56
|
-
...CarouselArrows(arrowStyles),
|
|
57
|
-
...CarouselDots({ dotColor, sx: dotStyles }),
|
|
58
62
|
...others,
|
|
59
63
|
};
|
|
60
64
|
|
|
65
|
+
// compute final settings
|
|
66
|
+
const finalSettings: Settings = { ...baseSettings };
|
|
67
|
+
|
|
68
|
+
// ---- arrows handling ----
|
|
69
|
+
// Priority:
|
|
70
|
+
// 1. arrows prop is object -> use its config
|
|
71
|
+
// 2. arrowStyles prop provided -> use default arrow components with that sx
|
|
72
|
+
// 3. arrows === true -> let react-slick render default arrows (no custom nextArrow/prevArrow)
|
|
73
|
+
if (typeof arrows === "object") {
|
|
74
|
+
Object.assign(finalSettings, createArrows(arrows));
|
|
75
|
+
} else if (arrowStyles) {
|
|
76
|
+
Object.assign(finalSettings, createArrows({ sx: arrowStyles }));
|
|
77
|
+
} else if (arrows === true) {
|
|
78
|
+
finalSettings.arrows = true;
|
|
79
|
+
} else {
|
|
80
|
+
finalSettings.arrows = Boolean(arrows); // false or undefined -> false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ---- dots handling ----
|
|
84
|
+
if (typeof dots === "object") {
|
|
85
|
+
Object.assign(finalSettings, createDots(dots));
|
|
86
|
+
} else if (dotColor || dotStyles) {
|
|
87
|
+
Object.assign(
|
|
88
|
+
finalSettings,
|
|
89
|
+
createDots({ dotColor: dotColor, sx: dotStyles }),
|
|
90
|
+
);
|
|
91
|
+
} else {
|
|
92
|
+
finalSettings.dots = Boolean(dots);
|
|
93
|
+
}
|
|
94
|
+
|
|
61
95
|
return (
|
|
62
96
|
<RootStyle space={spaceBetween} sx={{ height, paddingBottom: "25px" }}>
|
|
63
|
-
<
|
|
97
|
+
<Slider ref={ref} {...finalSettings}>
|
|
64
98
|
{children}
|
|
65
|
-
</
|
|
99
|
+
</Slider>
|
|
66
100
|
</RootStyle>
|
|
67
101
|
);
|
|
68
102
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomArrowProps } from "react-slick";
|
|
1
|
+
import { Settings, CustomArrowProps } from "react-slick";
|
|
2
2
|
import { SxProps, Theme } from "@mui/material/styles";
|
|
3
3
|
// MUI ICON COMPONENTS
|
|
4
4
|
import ArrowBack from "@mui/icons-material/ArrowBack";
|
|
@@ -6,55 +6,49 @@ import ArrowForward from "@mui/icons-material/ArrowForward";
|
|
|
6
6
|
// STYLED COMPONENT
|
|
7
7
|
import { ArrowButton } from "../styles/index";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
interface ArrowProps extends CustomArrowProps {
|
|
9
|
+
type ArrowConfig = {
|
|
11
10
|
sx?: SxProps<Theme>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const updatedClassName =
|
|
17
|
-
className ||
|
|
18
|
-
""
|
|
19
|
-
.split(" ")
|
|
20
|
-
.filter((item: string) => item !== "slick-next")
|
|
21
|
-
.join(" ");
|
|
11
|
+
// optionally allow custom components:
|
|
12
|
+
NextArrow?: React.ComponentType<CustomArrowProps & { sx?: SxProps<Theme> }>;
|
|
13
|
+
PrevArrow?: React.ComponentType<CustomArrowProps & { sx?: SxProps<Theme> }>;
|
|
14
|
+
};
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
const DefaultNextArrow: React.FC<
|
|
17
|
+
CustomArrowProps & { sx?: SxProps<Theme> }
|
|
18
|
+
> = ({ onClick, className, sx }) => (
|
|
19
|
+
<ArrowButton
|
|
20
|
+
right={0}
|
|
21
|
+
onClick={onClick}
|
|
22
|
+
className={`next ${className || ""}`}
|
|
23
|
+
sx={{ ...sx }}
|
|
24
|
+
>
|
|
25
|
+
<ArrowForward fontSize="small" color="inherit" />
|
|
26
|
+
</ArrowButton>
|
|
27
|
+
);
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
className={`prev ${updatedClassName}`}
|
|
48
|
-
sx={{ ...sx }}
|
|
49
|
-
>
|
|
50
|
-
<ArrowBack fontSize="small" color="inherit" className="back-icon" />
|
|
51
|
-
</ArrowButton>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
29
|
+
const DefaultPrevArrow: React.FC<
|
|
30
|
+
CustomArrowProps & { sx?: SxProps<Theme> }
|
|
31
|
+
> = ({ onClick, className, sx }) => (
|
|
32
|
+
<ArrowButton
|
|
33
|
+
left={0}
|
|
34
|
+
onClick={onClick}
|
|
35
|
+
className={`prev ${className || ""}`}
|
|
36
|
+
sx={{ ...sx }}
|
|
37
|
+
>
|
|
38
|
+
<ArrowBack fontSize="small" color="inherit" />
|
|
39
|
+
</ArrowButton>
|
|
40
|
+
);
|
|
54
41
|
|
|
55
|
-
|
|
42
|
+
/**
|
|
43
|
+
* If you want to compute and spread settings manually:
|
|
44
|
+
* <Carousel {...createArrows({ sx: {...} })} {...createDots({ dotColor: "green" })} />
|
|
45
|
+
*/
|
|
46
|
+
export function createArrows(cfg: ArrowConfig = {}): Partial<Settings> {
|
|
47
|
+
const Next = cfg.NextArrow ?? DefaultNextArrow;
|
|
48
|
+
const Prev = cfg.PrevArrow ?? DefaultPrevArrow;
|
|
56
49
|
return {
|
|
57
|
-
nextArrow: <
|
|
58
|
-
prevArrow: <
|
|
50
|
+
nextArrow: <Next sx={cfg.sx} />,
|
|
51
|
+
prevArrow: <Prev sx={cfg.sx} />,
|
|
52
|
+
arrows: true,
|
|
59
53
|
};
|
|
60
54
|
}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Settings } from "react-slick";
|
|
2
|
+
import { SxProps, Theme } from "@mui/material/styles";
|
|
3
3
|
// STYLED COMPONENTS
|
|
4
4
|
import { Dot, DotList } from "../styles/index";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
interface Props extends BoxProps {
|
|
6
|
+
type DotConfig = {
|
|
8
7
|
dotColor?: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export default function CarouselDots({ dotColor, ...props }: Props) {
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
};
|
|
10
|
+
export function createDots(cfg: DotConfig = {}): Partial<Settings> {
|
|
13
11
|
return {
|
|
14
|
-
customPaging: () => <Dot dotColor={dotColor} />,
|
|
15
|
-
appendDots: (dots: ReactNode) => (
|
|
16
|
-
<DotList
|
|
17
|
-
{dots}
|
|
18
|
-
</DotList>
|
|
12
|
+
customPaging: () => <Dot dotColor={cfg.dotColor} />,
|
|
13
|
+
appendDots: (dots: React.ReactNode) => (
|
|
14
|
+
<DotList sx={{ ...cfg.sx }}>{dots}</DotList>
|
|
19
15
|
),
|
|
16
|
+
dots: true,
|
|
20
17
|
};
|
|
21
18
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
import Grid from "@mui/material/Grid2";
|
|
2
3
|
import Button from "@mui/material/Button";
|
|
3
4
|
// GLOBAL CUSTOM COMPONENTS
|
|
@@ -6,59 +7,77 @@ import { Paragraph } from "@evenicanpm/storefront-core/src/components-v2/Typogra
|
|
|
6
7
|
// STYLED COMPONENT
|
|
7
8
|
import { StyledRoot } from "./styles";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
imgUrl?: string;
|
|
13
|
-
buttonLink?: string;
|
|
14
|
-
buttonText?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
buttonColor?: "dark" | "primary";
|
|
17
|
-
}
|
|
18
|
-
// ==================================================
|
|
10
|
+
type CarouselCard1Props = {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
title,
|
|
22
|
-
imgUrl,
|
|
23
|
-
buttonLink,
|
|
24
|
-
buttonText,
|
|
25
|
-
description,
|
|
26
|
-
}: Props) {
|
|
14
|
+
const CarouselCard1 = ({ children }: CarouselCard1Props) => {
|
|
27
15
|
return (
|
|
28
16
|
<StyledRoot>
|
|
29
17
|
<Grid container spacing={3} alignItems="center">
|
|
30
|
-
|
|
31
|
-
<h1 className="title">{title}</h1>
|
|
32
|
-
<Paragraph color="secondary.main" mb={2.7}>
|
|
33
|
-
{description}
|
|
34
|
-
</Paragraph>
|
|
35
|
-
|
|
36
|
-
<a href={buttonLink}>
|
|
37
|
-
<Button
|
|
38
|
-
size="large"
|
|
39
|
-
disableElevation
|
|
40
|
-
variant="contained"
|
|
41
|
-
className="button-link"
|
|
42
|
-
sx={{ height: 44, borderRadius: "4px" }}
|
|
43
|
-
>
|
|
44
|
-
{buttonText}
|
|
45
|
-
</Button>
|
|
46
|
-
</a>
|
|
47
|
-
</Grid>
|
|
48
|
-
|
|
49
|
-
<Grid size={{ xl: 8, md: 7, sm: 6, xs: 12 }}>
|
|
50
|
-
<BazaarImage
|
|
51
|
-
src={imgUrl ?? ""}
|
|
52
|
-
alt="apple-watch-1"
|
|
53
|
-
sx={{
|
|
54
|
-
mx: "auto",
|
|
55
|
-
maxHeight: 400,
|
|
56
|
-
display: "block",
|
|
57
|
-
maxWidth: "100%",
|
|
58
|
-
}}
|
|
59
|
-
/>
|
|
60
|
-
</Grid>
|
|
18
|
+
{children}
|
|
61
19
|
</Grid>
|
|
62
20
|
</StyledRoot>
|
|
63
21
|
);
|
|
64
|
-
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
CarouselCard1.Info = ({ children }: { children: ReactNode }) => {
|
|
25
|
+
return (
|
|
26
|
+
<Grid className="Grid2-item" size={{ xl: 4, md: 5, sm: 6, xs: 12 }}>
|
|
27
|
+
{children}
|
|
28
|
+
</Grid>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
CarouselCard1.Title = ({ title }: { title?: string }) => {
|
|
33
|
+
return <h1 className="title">{title}</h1>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
CarouselCard1.Description = ({ description }: { description?: string }) => {
|
|
37
|
+
return (
|
|
38
|
+
<Paragraph color="secondary.main" mb={2.7}>
|
|
39
|
+
{description}
|
|
40
|
+
</Paragraph>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
CarouselCard1.Button = ({
|
|
45
|
+
buttonLink,
|
|
46
|
+
buttonText,
|
|
47
|
+
}: {
|
|
48
|
+
buttonLink?: string;
|
|
49
|
+
buttonText?: string;
|
|
50
|
+
}) => {
|
|
51
|
+
return (
|
|
52
|
+
<a href={buttonLink}>
|
|
53
|
+
<Button
|
|
54
|
+
size="large"
|
|
55
|
+
disableElevation
|
|
56
|
+
variant="contained"
|
|
57
|
+
className="button-link"
|
|
58
|
+
sx={{ height: 44, borderRadius: "4px" }}
|
|
59
|
+
>
|
|
60
|
+
{buttonText}
|
|
61
|
+
</Button>
|
|
62
|
+
</a>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
CarouselCard1.Image = ({ imgUrl }: { imgUrl?: string }) => {
|
|
67
|
+
return (
|
|
68
|
+
<Grid size={{ xl: 8, md: 7, sm: 6, xs: 12 }}>
|
|
69
|
+
<BazaarImage
|
|
70
|
+
src={imgUrl ?? ""}
|
|
71
|
+
alt="carousel card image"
|
|
72
|
+
sx={{
|
|
73
|
+
mx: "auto",
|
|
74
|
+
maxHeight: 400,
|
|
75
|
+
display: "block",
|
|
76
|
+
maxWidth: "100%",
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
</Grid>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default CarouselCard1;
|
|
@@ -1,59 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { Props } from "./types";
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { createContext, useContext, ReactNode } from "react";
|
|
5
4
|
import getCategories from "@/services/categories/queries/get-categories";
|
|
6
5
|
import { CategoryHierarchy } from "@/lib/category-helpers";
|
|
6
|
+
import { StyledRoot, SubMenuStyledRoot } from "./styles";
|
|
7
|
+
|
|
7
8
|
import MegaMenu1 from "@evenicanpm/storefront-core/src/components-v2/categories/mega-menu/mega-menu-1";
|
|
8
9
|
import MegaMenu2 from "@evenicanpm/storefront-core/src/components-v2/categories/mega-menu/mega-menu-2";
|
|
10
|
+
import CategoryListItem from "../category-list-item/index";
|
|
9
11
|
|
|
10
12
|
type MegaMenuType = "default" | "mega-menu-1" | "mega-menu-2";
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
interface CategoryListContextValue {
|
|
15
|
+
open?: boolean;
|
|
16
|
+
position: "absolute" | "relative";
|
|
17
|
+
megaMenuRenderers: Record<
|
|
18
|
+
MegaMenuType,
|
|
19
|
+
(children: CategoryHierarchy[]) => ReactNode
|
|
20
|
+
>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const CategoryListContext = createContext<CategoryListContextValue | null>(
|
|
24
|
+
null,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
interface RootProps {
|
|
28
|
+
open?: boolean;
|
|
29
|
+
position?: "absolute" | "relative";
|
|
30
|
+
categories?: CategoryHierarchy[];
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const CategoryList = ({
|
|
35
|
+
open,
|
|
36
|
+
position = "absolute",
|
|
37
|
+
categories,
|
|
38
|
+
children,
|
|
39
|
+
}: RootProps) => {
|
|
40
|
+
let { data: fetchedCategories } = getCategories.useSuspenseData();
|
|
41
|
+
const cats = categories ?? fetchedCategories ?? [];
|
|
15
42
|
|
|
16
43
|
const megaMenuRenderers: Record<
|
|
17
44
|
MegaMenuType,
|
|
18
45
|
(children: CategoryHierarchy[]) => ReactNode
|
|
19
46
|
> = {
|
|
20
|
-
default: (children) =>
|
|
47
|
+
default: (children) => <CategoryList.SubMenu items={children} />,
|
|
21
48
|
"mega-menu-1": (children) => <MegaMenu1 data={children} />,
|
|
22
49
|
"mega-menu-2": (children) => <MegaMenu2 data={children} />,
|
|
23
50
|
};
|
|
24
51
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const { RecordId, Name, Url, Children } = category;
|
|
35
|
-
const hasChildren = !!(Children && Children.length);
|
|
36
|
-
|
|
37
|
-
// Sub menu can also be "categories/mega-menu/mega-menu-1" or "mega-menu-2",
|
|
38
|
-
// Mega menus have submenu items listed in columns and also have option to show banners(offers).
|
|
39
|
-
// Which submenu to display should be decided from categopry data
|
|
40
|
-
const menuType: MegaMenuType = "default";
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<CategoryListItem
|
|
44
|
-
key={RecordId}
|
|
45
|
-
href={`/products/${Url}`}
|
|
46
|
-
title={Name ?? ""}
|
|
47
|
-
caret={hasChildren}
|
|
48
|
-
render={
|
|
49
|
-
hasChildren ? megaMenuRenderers[menuType]?.(Children) : null
|
|
50
|
-
}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
})}
|
|
54
|
-
</Wrapper>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
52
|
+
return (
|
|
53
|
+
<CategoryListContext.Provider value={{ open, position, megaMenuRenderers }}>
|
|
54
|
+
<StyledRoot elevation={2} open={open} position={position}>
|
|
55
|
+
{children ??
|
|
56
|
+
cats.map((c) => <CategoryList.Item key={c.RecordId} category={c} />)}
|
|
57
|
+
</StyledRoot>
|
|
58
|
+
</CategoryListContext.Provider>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
interface ItemProps {
|
|
63
|
+
category: CategoryHierarchy;
|
|
59
64
|
}
|
|
65
|
+
CategoryList.Item = ({ category }: ItemProps) => {
|
|
66
|
+
const ctx = useContext(CategoryListContext);
|
|
67
|
+
if (!ctx) return null;
|
|
68
|
+
const { megaMenuRenderers } = ctx;
|
|
69
|
+
const { RecordId, Name, Url, Children } = category;
|
|
70
|
+
const hasChildren = !!Children?.length;
|
|
71
|
+
|
|
72
|
+
// Sub menu can also be "categories/mega-menu/mega-menu-1" or "mega-menu-2",
|
|
73
|
+
// Mega menus have submenu items listed in columns and also have option to show banners(offers).
|
|
74
|
+
// Which submenu to display should be decided from categopry data
|
|
75
|
+
const menuType: MegaMenuType = "default";
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<CategoryListItem
|
|
79
|
+
key={RecordId}
|
|
80
|
+
href={`/products/${Url}`}
|
|
81
|
+
title={Name ?? ""}
|
|
82
|
+
caret={hasChildren}
|
|
83
|
+
render={hasChildren ? megaMenuRenderers[menuType]?.(Children!) : null}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
interface SubMenuProps {
|
|
89
|
+
items: CategoryHierarchy[];
|
|
90
|
+
}
|
|
91
|
+
CategoryList.SubMenu = ({ items }: SubMenuProps) => {
|
|
92
|
+
return (
|
|
93
|
+
<SubMenuStyledRoot elevation={2}>
|
|
94
|
+
{items.map((c) => (
|
|
95
|
+
<CategoryList.Item key={c.RecordId} category={c} />
|
|
96
|
+
))}
|
|
97
|
+
</SubMenuStyledRoot>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default CategoryList;
|
|
@@ -2,8 +2,14 @@ import styled from "@mui/material/styles/styled";
|
|
|
2
2
|
import { Props } from "./types";
|
|
3
3
|
import Card from "@mui/material/Card";
|
|
4
4
|
|
|
5
|
+
interface StyledRootProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
elevation: number;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
position: "absolute" | "relative";
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
// styled component
|
|
6
|
-
export const StyledRoot = styled("div", {
|
|
12
|
+
export const StyledRoot: React.FC<StyledRootProps> = styled("div", {
|
|
7
13
|
shouldForwardProp: (prop) => prop !== "position" && prop !== "open",
|
|
8
14
|
})<Props>(({ theme, position, open }) => ({
|
|
9
15
|
left: 0,
|
|
@@ -26,6 +26,8 @@ type Props = {
|
|
|
26
26
|
};
|
|
27
27
|
// ===========================================================
|
|
28
28
|
|
|
29
|
+
// CategoryMenu is acting purely as a configuration/wiring component,
|
|
30
|
+
// not as a reusable UI element that needs further extensibility.
|
|
29
31
|
export default function CategoryMenu({ render }: Props) {
|
|
30
32
|
const [open, setOpen] = useState(false);
|
|
31
33
|
|