@evenicanpm/storefront-core 1.0.0-alpha
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/README.md +40 -0
- package/package.json +36 -0
- package/src/api-manager/README.md +38 -0
- package/src/api-manager/api-manager.config.json +12 -0
- package/src/api-manager/datasources/README.md +17 -0
- package/src/api-manager/datasources/d365/d365-address.datasource.ts +141 -0
- package/src/api-manager/datasources/d365/d365-base.datasource.ts +8 -0
- package/src/api-manager/datasources/d365/d365-cart.datasource.ts +374 -0
- package/src/api-manager/datasources/d365/d365-categories.datasource.ts +40 -0
- package/src/api-manager/datasources/d365/d365-order.datasource.ts +69 -0
- package/src/api-manager/datasources/d365/d365-organization.datasource.ts +92 -0
- package/src/api-manager/datasources/d365/d365-product.datasource.ts +272 -0
- package/src/api-manager/datasources/d365/d365-session.datasource.ts +25 -0
- package/src/api-manager/datasources/d365/d365-user.datasource.ts +132 -0
- package/src/api-manager/datasources/d365/d365.datasource.ts +45 -0
- package/src/api-manager/datasources/d365/index.ts +4 -0
- package/src/api-manager/datasources/d365/test-context.ts +30 -0
- package/src/api-manager/datasources/d365/utils/create-search-criteria.ts +17 -0
- package/src/api-manager/datasources/d365/utils/decode-jwt.ts +11 -0
- package/src/api-manager/datasources/d365/utils/get-context-cookie.ts +37 -0
- package/src/api-manager/datasources/d365/utils/parse-object.ts +9 -0
- package/src/api-manager/datasources/d365/utils/product-images-utils.ts +43 -0
- package/src/api-manager/datasources/d365/utils/product-inventory-utils.ts +37 -0
- package/src/api-manager/datasources/e4/e4-address.datasource.ts +107 -0
- package/src/api-manager/datasources/e4/e4-cart.datasource.ts +248 -0
- package/src/api-manager/datasources/e4/e4-order.datasource.ts +43 -0
- package/src/api-manager/datasources/e4/e4-organization.datasource.ts +19 -0
- package/src/api-manager/datasources/e4/e4-product.datasource.ts +157 -0
- package/src/api-manager/datasources/e4/e4-session.datasource.ts +43 -0
- package/src/api-manager/datasources/e4/e4-user.datasource.ts +118 -0
- package/src/api-manager/datasources/e4/e4.datasource.ts +55 -0
- package/src/api-manager/datasources/e4/e4.remaps.ts +331 -0
- package/src/api-manager/datasources/e4/e4.translator.test.ts +202 -0
- package/src/api-manager/datasources/e4/e4.translator.ts +648 -0
- package/src/api-manager/datasources/e4/graphqlRequestSdk.ts +43515 -0
- package/src/api-manager/datasources/e4/utils/unwrap-e4-variants.ts +65 -0
- package/src/api-manager/index.ts +71 -0
- package/src/api-manager/lib/cart-cookie-handler.ts +14 -0
- package/src/api-manager/lib/category-helpers.ts +113 -0
- package/src/api-manager/lib/get-dynamics-context.ts +34 -0
- package/src/api-manager/lib/get-graphql-client.test.ts +106 -0
- package/src/api-manager/lib/get-graphql-client.ts +53 -0
- package/src/api-manager/schemas/README.md +12 -0
- package/src/api-manager/schemas/address.schema.ts +46 -0
- package/src/api-manager/schemas/cart.schema.ts +92 -0
- package/src/api-manager/schemas/d365.schema.ts +7727 -0
- package/src/api-manager/schemas/order.schema.ts +30 -0
- package/src/api-manager/schemas/organization.schema.ts +32 -0
- package/src/api-manager/schemas/product.schema.ts +140 -0
- package/src/api-manager/schemas/session.schema.ts +17 -0
- package/src/api-manager/schemas/user.schema.ts +14 -0
- package/src/api-manager/services/address/mutations/create-address.ts +22 -0
- package/src/api-manager/services/address/mutations/delete-address.ts +21 -0
- package/src/api-manager/services/address/mutations/get-delivery-options.ts +22 -0
- package/src/api-manager/services/address/mutations/update-address.ts +21 -0
- package/src/api-manager/services/address/queries/get-countries.ts +16 -0
- package/src/api-manager/services/address/queries/get-states.ts +16 -0
- package/src/api-manager/services/cart/mutations/add-discount-code.ts +21 -0
- package/src/api-manager/services/cart/mutations/add-to-cart.ts +53 -0
- package/src/api-manager/services/cart/mutations/checkout.ts +11 -0
- package/src/api-manager/services/cart/mutations/delete-cart-line.ts +18 -0
- package/src/api-manager/services/cart/mutations/get-payment-accept-result.ts +20 -0
- package/src/api-manager/services/cart/mutations/remove-cart-line-delivery-mode.ts +24 -0
- package/src/api-manager/services/cart/mutations/remove-discount-code.ts +21 -0
- package/src/api-manager/services/cart/mutations/update-cart-line-delivery-mode.ts +24 -0
- package/src/api-manager/services/cart/mutations/update-cart-lines.ts +21 -0
- package/src/api-manager/services/cart/mutations/update-cart.ts +21 -0
- package/src/api-manager/services/cart/queries/get-cart.ts +12 -0
- package/src/api-manager/services/cart/queries/get-payment-accept-point.ts +18 -0
- package/src/api-manager/services/categories/queries/get-categories.ts +8 -0
- package/src/api-manager/services/create-mutation.ts +65 -0
- package/src/api-manager/services/create-query.ts +305 -0
- package/src/api-manager/services/get-query-client.ts +40 -0
- package/src/api-manager/services/order/queries/get-order-details.ts +17 -0
- package/src/api-manager/services/order/queries/get-orders.ts +14 -0
- package/src/api-manager/services/organization/queries/get-channel-configuration.ts +14 -0
- package/src/api-manager/services/organization/queries/get-stores.ts +17 -0
- package/src/api-manager/services/product/mutations/search-products.ts +23 -0
- package/src/api-manager/services/product/queries/get-product-availability.ts +15 -0
- package/src/api-manager/services/product/queries/get-product-by-id.ts +17 -0
- package/src/api-manager/services/product/queries/get-product-by-ids.ts +14 -0
- package/src/api-manager/services/product/queries/get-product-list.ts +16 -0
- package/src/api-manager/services/product/queries/get-related-products.ts +14 -0
- package/src/api-manager/services/product/queries/search-products.ts +10 -0
- package/src/api-manager/services/product/server/product.server.ts +13 -0
- package/src/api-manager/services/session/mutations/session-init.ts +22 -0
- package/src/api-manager/services/session/mutations/session-logout.ts +18 -0
- package/src/api-manager/services/session/queries/get-session.ts +10 -0
- package/src/api-manager/services/user/mutations/create-wishlist.ts +21 -0
- package/src/api-manager/services/user/mutations/delete-wishlist.ts +17 -0
- package/src/api-manager/services/user/mutations/update-user.ts +18 -0
- package/src/api-manager/services/user/queries/get-user-counts.ts +10 -0
- package/src/api-manager/services/user/queries/get-user.ts +10 -0
- package/src/api-manager/services/user/queries/get-wishlist-details.ts +10 -0
- package/src/api-manager/services/user/queries/get-wishlists.ts +10 -0
- package/src/api-manager/types/Datasource.ts +197 -0
- package/src/auth/auth-options.test.ts +127 -0
- package/src/auth/auth-options.ts +68 -0
- package/src/auth/msal.ts +65 -0
- package/src/auth/next-auth-cookie-manager.ts +86 -0
- package/src/auth/providers/aadb2c-provider.ts +33 -0
- package/src/auth/providers/authentik-provider.ts +24 -0
- package/src/auth/providers/index.ts +9 -0
- package/src/auth/providers/keycloak-provider.ts +22 -0
- package/src/auth/refresh-token-url-keys.ts +6 -0
- package/src/auth/refresh-token.ts +134 -0
- package/src/auth/signout.ts +46 -0
- package/src/auth/types/next-auth.d.ts +38 -0
- package/src/cms/blog.ts +229 -0
- package/src/cms/endpoints.ts +76 -0
- package/src/cms/interfaces/navigation.ts +52 -0
- package/src/cms/interfaces/productData.ts +83 -0
- package/src/cms/pages.ts +149 -0
- package/src/components/Blocks/BlockManager.tsx +67 -0
- package/src/components/Blocks/Components/BrandLogosScroller.tsx +72 -0
- package/src/components/Blocks/Components/CategoryCard.tsx +47 -0
- package/src/components/Blocks/Components/CategoryCarousel/index.tsx +60 -0
- package/src/components/Blocks/Components/FeaturePill.tsx +99 -0
- package/src/components/Blocks/Components/FeaturedCategories.tsx +41 -0
- package/src/components/Blocks/Components/FeaturedProducts.tsx +41 -0
- package/src/components/Blocks/Components/Footer.tsx +77 -0
- package/src/components/Blocks/Components/Hero.tsx +73 -0
- package/src/components/Blocks/Components/HeroCarousel/index.tsx +42 -0
- package/src/components/Blocks/Components/Image.tsx +39 -0
- package/src/components/Blocks/Components/MediaCard.tsx +41 -0
- package/src/components/Blocks/Components/ProductCarousel/index.tsx +82 -0
- package/src/components/Blocks/Components/ProductSectionFullWidth/index.tsx +103 -0
- package/src/components/Blocks/Components/RichText.tsx +19 -0
- package/src/components/Blocks/Components/Seo/index.tsx +48 -0
- package/src/components/Blocks/Components/Services/index.tsx +21 -0
- package/src/components/Blocks/Components/Services/service-card.tsx +70 -0
- package/src/components/Blocks/Components/shared/featured-product-card.tsx +29 -0
- package/src/components/Blocks/Components/shared/product-category-item.tsx +49 -0
- package/src/components/Blocks/Components/shared/product-grid.tsx +48 -0
- package/src/components/Blocks/Components/shared/top-categories-card.tsx +66 -0
- package/src/components/Blocks/Components/shared/top-rating-product-card.tsx +63 -0
- package/src/components/Blocks/Icons/Components/Category.tsx +14 -0
- package/src/components/Blocks/Icons/Components/DottedStar.tsx +40 -0
- package/src/components/Blocks/Icons/Components/FallbackIcon.tsx +33 -0
- package/src/components/Blocks/Icons/Components/GiftBox.tsx +18 -0
- package/src/components/Blocks/Icons/Components/Light.tsx +13 -0
- package/src/components/Blocks/Icons/Components/NewArrival.tsx +18 -0
- package/src/components/Blocks/Icons/Components/RankBadge.tsx +39 -0
- package/src/components/Blocks/Icons/index.ts +32 -0
- package/src/components/Blocks/index.tsx +16 -0
- package/src/components/Blocks/interfaces.ts +240 -0
- package/src/components/BoxShadowCard.tsx +16 -0
- package/src/components/Footer/data/index.ts +32 -0
- package/src/components/Footer/index.tsx +88 -0
- package/src/components/Footer/interfaces.ts +37 -0
- package/src/components/Footer/sections/FooterAppStore.tsx +45 -0
- package/src/components/Footer/sections/FooterContact.tsx +36 -0
- package/src/components/Footer/sections/FooterLinks.tsx +30 -0
- package/src/components/Footer/sections/FooterLogo.tsx +26 -0
- package/src/components/Footer/sections/FooterSocialLinks.tsx +70 -0
- package/src/components/Footer/styles/index.ts +39 -0
- package/src/components/GlobalLoading/index.tsx +102 -0
- package/src/components/ImageWithFallback.tsx +51 -0
- package/src/components/Loading/index.tsx +36 -0
- package/src/components/NavProvider/index.tsx +59 -0
- package/src/components/NavProvider/utils/createLink.ts +15 -0
- package/src/components/Notifications/README.md +15 -0
- package/src/components/Notifications/notification-context.tsx +82 -0
- package/src/components/Notifications/use-notification.ts +12 -0
- package/src/components/README.md +9 -0
- package/src/components/ReactQueryProvider/index.tsx +12 -0
- package/src/components/Shared/Image.tsx +5 -0
- package/src/components/T/index.tsx +15 -0
- package/src/components/_components/BazaarCard.tsx +21 -0
- package/src/components/_components/BazaarImage.tsx +12 -0
- package/src/components/_components/BazaarMenu.tsx +47 -0
- package/src/components/_components/BazaarSwitch.tsx +37 -0
- package/src/components/_components/BazaarTextField.tsx +73 -0
- package/src/components/_components/DropZone.tsx +86 -0
- package/src/components/_components/HoverBox.tsx +22 -0
- package/src/components/_components/LazyImage.tsx +9 -0
- package/src/components/_components/MiniCartClient.tsx +65 -0
- package/src/components/_components/SearchInput.tsx +28 -0
- package/src/components/_components/SnackbarProvider.tsx +32 -0
- package/src/components/_components/Typography.tsx +227 -0
- package/src/components/_components/WhiteButton.tsx +20 -0
- package/src/components/_components/accordion/accordion-header.tsx +43 -0
- package/src/components/_components/accordion/index.ts +1 -0
- package/src/components/_components/bazaar-types.ts +84 -0
- package/src/components/_components/carousel/carousel.tsx +72 -0
- package/src/components/_components/carousel/components/carousel-arrows.tsx +60 -0
- package/src/components/_components/carousel/components/carousel-dots.tsx +21 -0
- package/src/components/_components/carousel/index.ts +3 -0
- package/src/components/_components/carousel/styles/index.ts +93 -0
- package/src/components/_components/carousel-cards/carousel-card-1/carousel-card-1.tsx +64 -0
- package/src/components/_components/carousel-cards/carousel-card-1/index.ts +1 -0
- package/src/components/_components/carousel-cards/carousel-card-1/styles.ts +34 -0
- package/src/components/_components/carousel-cards/carousel-card-2/carousel-card-2.tsx +73 -0
- package/src/components/_components/carousel-cards/carousel-card-2/index.ts +1 -0
- package/src/components/_components/carousel-cards/carousel-card-2/styles.ts +26 -0
- package/src/components/_components/carousel-cards/carousel-card-3/carousel-card-3.tsx +34 -0
- package/src/components/_components/carousel-cards/carousel-card-3/index.ts +1 -0
- package/src/components/_components/carousel-cards/carousel-card-3/styles.ts +28 -0
- package/src/components/_components/carousel-cards/carousel-card-4/carousel-card-4.tsx +76 -0
- package/src/components/_components/carousel-cards/carousel-card-4/index.ts +1 -0
- package/src/components/_components/carousel-cards/carousel-card-4/styles.ts +27 -0
- package/src/components/_components/categories/category-list/category-list.tsx +59 -0
- package/src/components/_components/categories/category-list/index.ts +1 -0
- package/src/components/_components/categories/category-list/styles.ts +29 -0
- package/src/components/_components/categories/category-list/types.ts +4 -0
- package/src/components/_components/categories/category-list-item/category-menu-item.tsx +37 -0
- package/src/components/_components/categories/category-list-item/index.ts +1 -0
- package/src/components/_components/categories/category-list-item/styles.ts +35 -0
- package/src/components/_components/categories/category-menu.tsx +51 -0
- package/src/components/_components/categories/mega-menu/banner.tsx +56 -0
- package/src/components/_components/categories/mega-menu/column-list.tsx +70 -0
- package/src/components/_components/categories/mega-menu/mega-menu-1.tsx +37 -0
- package/src/components/_components/categories/mega-menu/mega-menu-2.tsx +37 -0
- package/src/components/_components/categories/mega-menu/styles.ts +25 -0
- package/src/components/_components/categories/types.ts +16 -0
- package/src/components/_components/category-cards/category-card-1/category-card-1.tsx +21 -0
- package/src/components/_components/category-cards/category-card-1/index.ts +1 -0
- package/src/components/_components/category-cards/category-card-1/styles.ts +37 -0
- package/src/components/_components/countdown/count-box.tsx +16 -0
- package/src/components/_components/countdown/count-down.tsx +24 -0
- package/src/components/_components/countdown/index.tsx +2 -0
- package/src/components/_components/countdown/useCountDown.ts +41 -0
- package/src/components/_components/data-table/index.ts +2 -0
- package/src/components/_components/data-table/table-header.tsx +91 -0
- package/src/components/_components/data-table/table-pagination.tsx +36 -0
- package/src/components/_components/flex-box/flex-between.tsx +14 -0
- package/src/components/_components/flex-box/flex-box.tsx +9 -0
- package/src/components/_components/flex-box/flex-row-center.tsx +9 -0
- package/src/components/_components/flex-box/index.ts +5 -0
- package/src/components/_components/footer/components/about-links.tsx +23 -0
- package/src/components/_components/footer/components/app-store.tsx +38 -0
- package/src/components/_components/footer/components/customer-care-links.tsx +21 -0
- package/src/components/_components/footer/components/logo.tsx +23 -0
- package/src/components/_components/footer/components/social-links.tsx +43 -0
- package/src/components/_components/footer/data/index.ts +54 -0
- package/src/components/_components/footer/footer-1.tsx +62 -0
- package/src/components/_components/footer/footer-2.tsx +57 -0
- package/src/components/_components/footer/footer-3.tsx +53 -0
- package/src/components/_components/footer/footer-4.tsx +71 -0
- package/src/components/_components/footer/index.ts +4 -0
- package/src/components/_components/footer/styles/index.ts +42 -0
- package/src/components/_components/header/components/categories-menu.tsx +23 -0
- package/src/components/_components/header/components/mobile-header.tsx +72 -0
- package/src/components/_components/header/components/user.test.tsx +200 -0
- package/src/components/_components/header/components/user.tsx +205 -0
- package/src/components/_components/header/header.tsx +63 -0
- package/src/components/_components/header/hooks/use-header.ts +13 -0
- package/src/components/_components/header/index.ts +1 -0
- package/src/components/_components/header/sticky-header.tsx +17 -0
- package/src/components/_components/header/styles/index.ts +24 -0
- package/src/components/_components/hooks/useOverflowDetect.ts +34 -0
- package/src/components/_components/hooks/useSettings.ts +16 -0
- package/src/components/_components/icons/cart-bag.tsx +13 -0
- package/src/components/_components/icons/category-outline.tsx +29 -0
- package/src/components/_components/icons/category.tsx +12 -0
- package/src/components/_components/icons/home.tsx +19 -0
- package/src/components/_components/icons/search.tsx +13 -0
- package/src/components/_components/icons/shopping-bag-outlined.tsx +13 -0
- package/src/components/_components/icons/up-down.tsx +21 -0
- package/src/components/_components/icons/user.tsx +13 -0
- package/src/components/_components/icons/user2.tsx +14 -0
- package/src/components/_components/mini-cart/__tests__/cart-item.test.tsx +174 -0
- package/src/components/_components/mini-cart/__tests__/mini-cart.test.tsx +121 -0
- package/src/components/_components/mini-cart/__tests__/test-cart-empty.json +84 -0
- package/src/components/_components/mini-cart/__tests__/test-cart-with-item.json +244 -0
- package/src/components/_components/mini-cart/components/bottom-actions.tsx +27 -0
- package/src/components/_components/mini-cart/components/cart-item.tsx +144 -0
- package/src/components/_components/mini-cart/components/empty-view.tsx +29 -0
- package/src/components/_components/mini-cart/components/top-header.tsx +34 -0
- package/src/components/_components/mini-cart/index.ts +1 -0
- package/src/components/_components/mini-cart/mini-cart.tsx +107 -0
- package/src/components/_components/mobile-navigation/index.ts +3 -0
- package/src/components/_components/mobile-navigation/mobile-navigation-bar.tsx +73 -0
- package/src/components/_components/mobile-navigation/styles/index.ts +63 -0
- package/src/components/_components/nav-link/index.ts +5 -0
- package/src/components/_components/nav-link/nav-link-2.tsx +32 -0
- package/src/components/_components/nav-link/nav-link-3.tsx +67 -0
- package/src/components/_components/nav-link/nav-link.tsx +53 -0
- package/src/components/_components/navbar/categories.tsx +27 -0
- package/src/components/_components/navbar/category-based-menu/category-based-menu.tsx +52 -0
- package/src/components/_components/navbar/category-based-menu/components/categories.tsx +44 -0
- package/src/components/_components/navbar/category-based-menu/components/category-item.tsx +31 -0
- package/src/components/_components/navbar/category-based-menu/components/child-categories.tsx +38 -0
- package/src/components/_components/navbar/category-based-menu/index.ts +1 -0
- package/src/components/_components/navbar/category-based-menu/styles.ts +81 -0
- package/src/components/_components/navbar/category-based-menu/types.ts +18 -0
- package/src/components/_components/navbar/index.ts +1 -0
- package/src/components/_components/navbar/mega-menu/category-list.tsx +29 -0
- package/src/components/_components/navbar/mega-menu/index.ts +1 -0
- package/src/components/_components/navbar/mega-menu/mega-menu.tsx +71 -0
- package/src/components/_components/navbar/mega-menu/styles.ts +43 -0
- package/src/components/_components/navbar/mobile-menu/index.ts +1 -0
- package/src/components/_components/navbar/mobile-menu/mobile-menu.tsx +70 -0
- package/src/components/_components/navbar/mobile-menu/render-levels.test.tsx +71 -0
- package/src/components/_components/navbar/mobile-menu/render-levels.tsx +62 -0
- package/src/components/_components/navbar/nav-list/cms-nav.test.tsx +84 -0
- package/src/components/_components/navbar/nav-list/index.ts +1 -0
- package/src/components/_components/navbar/nav-list/nav-item-child.tsx +66 -0
- package/src/components/_components/navbar/nav-list/nav-list.tsx +119 -0
- package/src/components/_components/navbar/navbar.tsx +43 -0
- package/src/components/_components/navbar/styles.ts +90 -0
- package/src/components/_components/navbar/utils/transform-nav.test.ts +209 -0
- package/src/components/_components/navbar/utils/transform-nav.ts +43 -0
- package/src/components/_components/newsletter/index.ts +1 -0
- package/src/components/_components/newsletter/newsletter.tsx +108 -0
- package/src/components/_components/newsletter/social-icons.tsx +35 -0
- package/src/components/_components/newsletter/styles.ts +65 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/components/link-item.tsx +21 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/components/list-item.tsx +27 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/components/nav-accordion.tsx +36 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/components/render-child.tsx +26 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/grocery-side-nav.tsx +32 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/index.ts +1 -0
- package/src/components/_components/page-sidenav/grocery-side-nav/styles/index.ts +11 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/list-item.tsx +27 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/nav-accordion.tsx +44 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/components/render-child.tsx +20 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/health-beauty-side-nav.tsx +43 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/index.ts +1 -0
- package/src/components/_components/page-sidenav/health-beauty-side-nav/styles/index.ts +27 -0
- package/src/components/_components/page-sidenav/side-navbar/components/list-item.tsx +25 -0
- package/src/components/_components/page-sidenav/side-navbar/components/nav-accordion.tsx +46 -0
- package/src/components/_components/page-sidenav/side-navbar/components/render-child.tsx +20 -0
- package/src/components/_components/page-sidenav/side-navbar/index.ts +1 -0
- package/src/components/_components/page-sidenav/side-navbar/side-nav-bar.tsx +77 -0
- package/src/components/_components/page-sidenav/side-navbar/styles/index.ts +73 -0
- package/src/components/_components/page-sidenav/side-navbar-2/components/button-content.tsx +32 -0
- package/src/components/_components/page-sidenav/side-navbar-2/components/sidebar-accordion.tsx +66 -0
- package/src/components/_components/page-sidenav/side-navbar-2/index.ts +1 -0
- package/src/components/_components/page-sidenav/side-navbar-2/side-navbar-2.tsx +63 -0
- package/src/components/_components/page-sidenav/side-navbar-2/styles/index.ts +68 -0
- package/src/components/_components/product-cards/discount-chip.tsx +43 -0
- package/src/components/_components/product-cards/product-card-1/components/hover-actions.tsx +37 -0
- package/src/components/_components/product-cards/product-card-1/components/quantity-buttons.tsx +56 -0
- package/src/components/_components/product-cards/product-card-1/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-1/product-card.tsx +146 -0
- package/src/components/_components/product-cards/product-card-1/styles/index.ts +46 -0
- package/src/components/_components/product-cards/product-card-10/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-10/product-card.tsx +124 -0
- package/src/components/_components/product-cards/product-card-10/styles/index.ts +38 -0
- package/src/components/_components/product-cards/product-card-11/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-11/product-card.tsx +63 -0
- package/src/components/_components/product-cards/product-card-11/styles/index.ts +16 -0
- package/src/components/_components/product-cards/product-card-12/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-12/product-card.tsx +42 -0
- package/src/components/_components/product-cards/product-card-12/styles/index.ts +16 -0
- package/src/components/_components/product-cards/product-card-13/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-13/product-card.tsx +45 -0
- package/src/components/_components/product-cards/product-card-13/styles/index.ts +25 -0
- package/src/components/_components/product-cards/product-card-14/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-14/product-card.tsx +122 -0
- package/src/components/_components/product-cards/product-card-14/styles/index.ts +40 -0
- package/src/components/_components/product-cards/product-card-15/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-15/product-card.tsx +118 -0
- package/src/components/_components/product-cards/product-card-15/styles/index.ts +57 -0
- package/src/components/_components/product-cards/product-card-16/components/quantity-buttons.tsx +56 -0
- package/src/components/_components/product-cards/product-card-16/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-16/product-card.tsx +114 -0
- package/src/components/_components/product-cards/product-card-16/styles/index.ts +18 -0
- package/src/components/_components/product-cards/product-card-2/components/favorite-button.tsx +29 -0
- package/src/components/_components/product-cards/product-card-2/components/product-price.tsx +26 -0
- package/src/components/_components/product-cards/product-card-2/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-2/product-card.tsx +70 -0
- package/src/components/_components/product-cards/product-card-3/components/hover-actions.tsx +83 -0
- package/src/components/_components/product-cards/product-card-3/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-3/product-card.tsx +110 -0
- package/src/components/_components/product-cards/product-card-3/styles/index.ts +89 -0
- package/src/components/_components/product-cards/product-card-4/components/hover-actions.tsx +50 -0
- package/src/components/_components/product-cards/product-card-4/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-4/product-card.tsx +128 -0
- package/src/components/_components/product-cards/product-card-4/styles/index.ts +66 -0
- package/src/components/_components/product-cards/product-card-5/components/button-actions.tsx +49 -0
- package/src/components/_components/product-cards/product-card-5/components/hover-actions.tsx +50 -0
- package/src/components/_components/product-cards/product-card-5/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-5/product-card.tsx +137 -0
- package/src/components/_components/product-cards/product-card-5/styles/index.ts +94 -0
- package/src/components/_components/product-cards/product-card-6/components/hover-actions.tsx +50 -0
- package/src/components/_components/product-cards/product-card-6/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-6/product-card.tsx +121 -0
- package/src/components/_components/product-cards/product-card-6/styles/index.ts +63 -0
- package/src/components/_components/product-cards/product-card-7/components/product-status.tsx +18 -0
- package/src/components/_components/product-cards/product-card-7/components/quantity-buttons.tsx +47 -0
- package/src/components/_components/product-cards/product-card-7/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-7/product-card.tsx +136 -0
- package/src/components/_components/product-cards/product-card-7/styles/index.ts +98 -0
- package/src/components/_components/product-cards/product-card-8/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-8/product-card.tsx +133 -0
- package/src/components/_components/product-cards/product-card-8/styles/index.ts +51 -0
- package/src/components/_components/product-cards/product-card-9/components/add-to-cart.tsx +60 -0
- package/src/components/_components/product-cards/product-card-9/components/favorite-button.tsx +27 -0
- package/src/components/_components/product-cards/product-card-9/components/tags.tsx +33 -0
- package/src/components/_components/product-cards/product-card-9/index.ts +1 -0
- package/src/components/_components/product-cards/product-card-9/product-card.tsx +169 -0
- package/src/components/_components/product-cards/product-price.tsx +26 -0
- package/src/components/_components/product-cards/product-rating.tsx +28 -0
- package/src/components/_components/product-cards/product-title.tsx +24 -0
- package/src/components/_components/product-cards/use-product.ts +35 -0
- package/src/components/_components/products-view/product-view-dialog.tsx +180 -0
- package/src/components/_components/products-view/products-grid-view.tsx +39 -0
- package/src/components/_components/products-view/products-list-view.tsx +35 -0
- package/src/components/_components/progress/index.ts +1 -0
- package/src/components/_components/progress/progress.tsx +77 -0
- package/src/components/_components/scrollbar/index.ts +1 -0
- package/src/components/_components/scrollbar/scrollbar.tsx +27 -0
- package/src/components/_components/scrollbar/styles.ts +15 -0
- package/src/components/_components/search-box/components/category-dropdown.tsx +61 -0
- package/src/components/_components/search-box/components/search-result.tsx +29 -0
- package/src/components/_components/search-box/hooks/use-search.ts +63 -0
- package/src/components/_components/search-box/index.ts +2 -0
- package/src/components/_components/search-box/search-input-category.test.tsx +110 -0
- package/src/components/_components/search-box/search-input-category.tsx +104 -0
- package/src/components/_components/search-box/search-input.test.tsx +41 -0
- package/src/components/_components/search-box/search-input.tsx +64 -0
- package/src/components/_components/search-box/styles/index.ts +45 -0
- package/src/components/_components/section-header/index.ts +2 -0
- package/src/components/_components/section-header/section-creator.tsx +28 -0
- package/src/components/_components/section-header/section-header.tsx +44 -0
- package/src/components/_components/service-cards/icon-component.tsx +18 -0
- package/src/components/_components/service-cards/service-card-1/index.ts +1 -0
- package/src/components/_components/service-cards/service-card-1/service-card-1.tsx +39 -0
- package/src/components/_components/service-cards/service-card-2/index.ts +1 -0
- package/src/components/_components/service-cards/service-card-2/service-card-2.tsx +34 -0
- package/src/components/_components/service-cards/service-card-3/index.ts +1 -0
- package/src/components/_components/service-cards/service-card-3/service-card-3.tsx +25 -0
- package/src/components/_components/service-cards/service-card-3/styles.ts +23 -0
- package/src/components/_components/settings/index.ts +1 -0
- package/src/components/_components/settings/setting.tsx +141 -0
- package/src/components/_components/settings/styles.ts +57 -0
- package/src/components/_components/shop-card/index.ts +1 -0
- package/src/components/_components/shop-card/shop-card.tsx +152 -0
- package/src/components/_components/shop-card/styles.ts +33 -0
- package/src/components/_components/side-nav/index.ts +1 -0
- package/src/components/_components/side-nav/side-nav.tsx +49 -0
- package/src/components/_components/site-logo.tsx +17 -0
- package/src/components/_components/sticky/Sticky.tsx +62 -0
- package/src/components/_components/sticky/index.ts +1 -0
- package/src/components/_components/sticky/styles.ts +38 -0
- package/src/components/_components/sticky-wrapper/index.ts +1 -0
- package/src/components/_components/sticky-wrapper/sticky-wrapper.tsx +21 -0
- package/src/components/_components/sticky-wrapper/styles.ts +25 -0
- package/src/components/_components/stories/story-content/index.ts +1 -0
- package/src/components/_components/stories/story-content/story-content.tsx +28 -0
- package/src/components/_components/stories/story-content/styles.ts +22 -0
- package/src/components/_components/stories/story-item/index.ts +1 -0
- package/src/components/_components/stories/story-item/story-item.tsx +24 -0
- package/src/components/_components/stories/story-item/styles.ts +11 -0
- package/src/components/_components/stories/story-viewer/index.ts +1 -0
- package/src/components/_components/stories/story-viewer/story-viewer.tsx +44 -0
- package/src/components/_components/stories/story-viewer/styles.ts +15 -0
- package/src/components/_components/subscribe-input/index.ts +1 -0
- package/src/components/_components/subscribe-input/styles.ts +14 -0
- package/src/components/_components/subscribe-input/subscribe-input.tsx +43 -0
- package/src/components/_components/topbar/index.ts +1 -0
- package/src/components/_components/topbar/styles.ts +55 -0
- package/src/components/_components/topbar/top-bar.tsx +112 -0
- package/src/components/_components/utils/constants.ts +8 -0
- package/src/components/countries-input.tsx +78 -0
- package/src/config.ts +47 -0
- package/src/lib/build-detail-url.ts +8 -0
- package/src/lib/build-product-detail-url.ts +12 -0
- package/src/lib/cart-cookie-client-handler.ts +12 -0
- package/src/lib/cart-cookie-handler.ts +14 -0
- package/src/lib/category-helpers.ts +113 -0
- package/src/lib/create-graphql-client.ts +32 -0
- package/src/lib/currency-formatter.ts +31 -0
- package/src/lib/get-palette-color.ts +50 -0
- package/src/lib/graphqlRequestSdk.ts +41234 -0
- package/src/lib/hexToLuma.ts +55 -0
- package/src/lib/lib.ts +61 -0
- package/src/lib/map-helper.ts +71 -0
- package/src/lib/page-slugs.ts +10 -0
- package/src/lib/refiner-utils.ts +32 -0
- package/src/lib/store-hours-helper.ts +274 -0
- package/src/lib/test-media.ts +23 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Box from "@mui/material/Box";
|
|
2
|
+
import Button from "@mui/material/Button";
|
|
3
|
+
import styled from "@mui/material/styles/styled";
|
|
4
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
5
|
+
import { Span } from "@/components/_components/Typography";
|
|
6
|
+
|
|
7
|
+
export const StyledCard = styled(Box)(({ theme }) => ({
|
|
8
|
+
height: "100%",
|
|
9
|
+
margin: "auto",
|
|
10
|
+
borderRadius: 0,
|
|
11
|
+
overflow: "hidden",
|
|
12
|
+
position: "relative",
|
|
13
|
+
transition: "all 250ms ease-in-out",
|
|
14
|
+
outline: `2px solid ${theme.palette.grey[50]}`,
|
|
15
|
+
":hover": { boxShadow: theme.shadows[2] },
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
export const ImgBox = styled("div")(({ theme }) => ({
|
|
19
|
+
height: 230,
|
|
20
|
+
marginBottom: "5rem",
|
|
21
|
+
padding: "60px 40px 20px 40px",
|
|
22
|
+
background: theme.palette.grey[100],
|
|
23
|
+
".img-wrapper": { maxWidth: 300, margin: "auto" },
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
export const ContentWrapper = styled("div")({
|
|
27
|
+
gap: 8,
|
|
28
|
+
display: "flex",
|
|
29
|
+
padding: "1rem",
|
|
30
|
+
".content": { flex: "1 1 0" },
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const StatusChipBox = styled("div")(({ theme }) => ({
|
|
34
|
+
width: 40,
|
|
35
|
+
height: 42,
|
|
36
|
+
zIndex: 11,
|
|
37
|
+
top: "0px",
|
|
38
|
+
right: "30px",
|
|
39
|
+
fontSize: "12px",
|
|
40
|
+
position: "absolute",
|
|
41
|
+
background: theme.palette.primary.main,
|
|
42
|
+
|
|
43
|
+
".triangle": {
|
|
44
|
+
width: "100%",
|
|
45
|
+
display: "flex",
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
".triangle-left": {
|
|
49
|
+
width: 0,
|
|
50
|
+
height: 0,
|
|
51
|
+
borderTop: "0px solid transparent",
|
|
52
|
+
borderBottom: "10px solid transparent",
|
|
53
|
+
borderLeft: `20px solid ${theme.palette.primary.main}`,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
".triangle-right": {
|
|
57
|
+
width: 0,
|
|
58
|
+
height: 0,
|
|
59
|
+
borderTop: "0px solid transparent",
|
|
60
|
+
borderBottom: "10px solid transparent",
|
|
61
|
+
borderRight: `20px solid ${theme.palette.primary.main}`,
|
|
62
|
+
},
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
export const StatusChip = styled(Span)({
|
|
66
|
+
color: "#fff",
|
|
67
|
+
height: "100%",
|
|
68
|
+
display: "flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const ColorBox = styled("div")(({ theme }) => ({
|
|
74
|
+
gap: 8,
|
|
75
|
+
display: "flex",
|
|
76
|
+
padding: "10px 5px",
|
|
77
|
+
"& span": {
|
|
78
|
+
width: 12,
|
|
79
|
+
height: 12,
|
|
80
|
+
borderRadius: 8,
|
|
81
|
+
"&:hover": {
|
|
82
|
+
cursor: "pointer",
|
|
83
|
+
outline: `2px solid ${theme.palette.grey[200]}`,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
export const StyledButton = styled(Button)(({ theme }) => ({
|
|
89
|
+
padding: "4px",
|
|
90
|
+
borderRadius: 0,
|
|
91
|
+
transition: "all 0.3s",
|
|
92
|
+
color: theme.palette.primary.main,
|
|
93
|
+
":hover": {
|
|
94
|
+
color: "#fff",
|
|
95
|
+
background: theme.palette.primary.main,
|
|
96
|
+
border: `1px solid ${theme.palette.primary.main}`,
|
|
97
|
+
},
|
|
98
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./product-card";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import Box from "@mui/material/Box";
|
|
5
|
+
import Rating from "@mui/material/Rating";
|
|
6
|
+
// MUI ICON COMPONENTS
|
|
7
|
+
import Favorite from "@mui/icons-material/Favorite";
|
|
8
|
+
import FavoriteBorder from "@mui/icons-material/FavoriteBorder";
|
|
9
|
+
import AddShoppingCart from "@mui/icons-material/AddShoppingCart";
|
|
10
|
+
// LOCAL CUSTOM HOOK
|
|
11
|
+
import useProduct from "../use-product";
|
|
12
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
13
|
+
import LazyImage from "@/components/_components/LazyImage";
|
|
14
|
+
import { FlexRowCenter } from "@/components/_components/flex-box/index";
|
|
15
|
+
import { H4, Paragraph, Small } from "@/components/_components/Typography";
|
|
16
|
+
import ProductViewDialog from "@/components/_components/products-view/product-view-dialog";
|
|
17
|
+
// CUSTOM UTILS LIBRARY FUNCTION
|
|
18
|
+
import { currency } from "@/lib/lib";
|
|
19
|
+
// CUSTOM COMPONENTS
|
|
20
|
+
import {
|
|
21
|
+
AddToCartButton,
|
|
22
|
+
Card,
|
|
23
|
+
CardMedia,
|
|
24
|
+
FavoriteButton,
|
|
25
|
+
QuickViewButton,
|
|
26
|
+
} from "./styles/index";
|
|
27
|
+
// CUSTOM DATA MODEL
|
|
28
|
+
import { Product } from "@/components/_components/bazaar-types";
|
|
29
|
+
|
|
30
|
+
// ==============================================================
|
|
31
|
+
type Props = { product: Product };
|
|
32
|
+
// ==============================================================
|
|
33
|
+
|
|
34
|
+
export default function ProductCard8({ product }: Props) {
|
|
35
|
+
const { slug, id, title, price, thumbnail, images, categories, reviews } =
|
|
36
|
+
product || {};
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
cartItem,
|
|
40
|
+
handleCartAmountChange,
|
|
41
|
+
isFavorite,
|
|
42
|
+
openModal,
|
|
43
|
+
toggleDialog,
|
|
44
|
+
toggleFavorite,
|
|
45
|
+
} = useProduct(slug);
|
|
46
|
+
|
|
47
|
+
// HANDLE ADD TO CART PRODUCT
|
|
48
|
+
const handleAddToCart = () => {
|
|
49
|
+
const payload = {
|
|
50
|
+
id,
|
|
51
|
+
slug,
|
|
52
|
+
price,
|
|
53
|
+
name: title,
|
|
54
|
+
imgUrl: thumbnail,
|
|
55
|
+
qty: (cartItem?.Quantity || 0) + 1,
|
|
56
|
+
};
|
|
57
|
+
payload;
|
|
58
|
+
handleCartAmountChange();
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Card>
|
|
63
|
+
<CardMedia>
|
|
64
|
+
<Link href={`/products/${slug}`}>
|
|
65
|
+
<LazyImage
|
|
66
|
+
width={300}
|
|
67
|
+
height={300}
|
|
68
|
+
alt="category"
|
|
69
|
+
className="product-img"
|
|
70
|
+
src={thumbnail}
|
|
71
|
+
/>
|
|
72
|
+
</Link>
|
|
73
|
+
|
|
74
|
+
{/* ADD TO CART BUTTON */}
|
|
75
|
+
<AddToCartButton className="product-actions" onClick={handleAddToCart}>
|
|
76
|
+
<AddShoppingCart className="icon" fontSize="small" />
|
|
77
|
+
</AddToCartButton>
|
|
78
|
+
|
|
79
|
+
{/* PRODUCT FAVORITE BUTTON */}
|
|
80
|
+
<FavoriteButton className="product-actions" onClick={toggleFavorite}>
|
|
81
|
+
{isFavorite ? (
|
|
82
|
+
<Favorite className="icon" fontSize="small" color="primary" />
|
|
83
|
+
) : (
|
|
84
|
+
<FavoriteBorder className="icon" fontSize="small" />
|
|
85
|
+
)}
|
|
86
|
+
</FavoriteButton>
|
|
87
|
+
|
|
88
|
+
{/* PRODUCT QUICK VIEW BUTTON */}
|
|
89
|
+
<Box mx={1} position="relative">
|
|
90
|
+
<QuickViewButton
|
|
91
|
+
fullWidth
|
|
92
|
+
size="large"
|
|
93
|
+
variant="contained"
|
|
94
|
+
className="product-view-action"
|
|
95
|
+
onClick={toggleDialog}
|
|
96
|
+
>
|
|
97
|
+
Quick View
|
|
98
|
+
</QuickViewButton>
|
|
99
|
+
</Box>
|
|
100
|
+
</CardMedia>
|
|
101
|
+
|
|
102
|
+
{/* PRODUCT VIEW DIALOG BOX */}
|
|
103
|
+
<ProductViewDialog
|
|
104
|
+
openDialog={openModal}
|
|
105
|
+
handleCloseDialog={toggleDialog}
|
|
106
|
+
product={{ id, slug, title, price, imgGroup: images ?? [] }}
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<Box p={1} textAlign="center">
|
|
110
|
+
{/* PRODUCT CATEGORY */}
|
|
111
|
+
{categories.length > 0 ? (
|
|
112
|
+
<Small color="grey.500">{categories[0]}</Small>
|
|
113
|
+
) : null}
|
|
114
|
+
|
|
115
|
+
{/* PRODUCT TITLE / NAME */}
|
|
116
|
+
<Paragraph fontWeight="bold">{title}</Paragraph>
|
|
117
|
+
|
|
118
|
+
{/* PRODUCT PRICE */}
|
|
119
|
+
<H4 fontWeight={700} py={0.5}>
|
|
120
|
+
{currency(price)}
|
|
121
|
+
</H4>
|
|
122
|
+
|
|
123
|
+
{/* PRODUCT RATING / REVIEW */}
|
|
124
|
+
<FlexRowCenter gap={1}>
|
|
125
|
+
<Rating name="read-only" value={4} readOnly sx={{ fontSize: 16 }} />
|
|
126
|
+
<Small fontWeight={600} color="grey.500">
|
|
127
|
+
({reviews?.length} Reviews)
|
|
128
|
+
</Small>
|
|
129
|
+
</FlexRowCenter>
|
|
130
|
+
</Box>
|
|
131
|
+
</Card>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import Button from "@mui/material/Button";
|
|
2
|
+
import IconButton from "@mui/material/IconButton";
|
|
3
|
+
import styled from "@mui/material/styles/styled";
|
|
4
|
+
|
|
5
|
+
export const Card = styled("div")({
|
|
6
|
+
":hover": {
|
|
7
|
+
img: { transform: "scale(1.1)" },
|
|
8
|
+
".product-actions": { right: 15 },
|
|
9
|
+
".product-view-action": { opacity: 1 },
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const CardMedia = styled("div")(({ theme }) => ({
|
|
14
|
+
aspectRatio: "1/1",
|
|
15
|
+
// maxHeight: 300,
|
|
16
|
+
borderRadius: 4,
|
|
17
|
+
cursor: "pointer",
|
|
18
|
+
overflow: "hidden",
|
|
19
|
+
position: "relative",
|
|
20
|
+
backgroundColor: theme.palette.grey[300],
|
|
21
|
+
img: { transition: "0.3s" },
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
export const AddToCartButton = styled(IconButton)(({ theme }) => ({
|
|
25
|
+
top: 15,
|
|
26
|
+
right: -40,
|
|
27
|
+
position: "absolute",
|
|
28
|
+
backgroundColor: "white",
|
|
29
|
+
transition: "right 0.3s .1s",
|
|
30
|
+
color: theme.palette.text.primary,
|
|
31
|
+
".icon": { fontSize: 16 },
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
export const FavoriteButton = styled(IconButton)(({ theme }) => ({
|
|
35
|
+
top: 55,
|
|
36
|
+
right: -40,
|
|
37
|
+
position: "absolute",
|
|
38
|
+
backgroundColor: "white",
|
|
39
|
+
transition: "right 0.3s .2s",
|
|
40
|
+
color: theme.palette.text.primary,
|
|
41
|
+
".icon": { fontSize: 16 },
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
export const QuickViewButton = styled(Button)({
|
|
45
|
+
left: 0,
|
|
46
|
+
bottom: 12,
|
|
47
|
+
opacity: 0,
|
|
48
|
+
borderRadius: 4,
|
|
49
|
+
position: "absolute",
|
|
50
|
+
transition: "all 0.3s",
|
|
51
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
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 "@/components/_components/Typography";
|
|
7
|
+
import { FlexBetween, FlexBox } from "@/components/_components/flex-box/index";
|
|
8
|
+
|
|
9
|
+
// ==============================================================
|
|
10
|
+
interface Props {
|
|
11
|
+
quantity: number;
|
|
12
|
+
handleDecrement: () => void;
|
|
13
|
+
handleIncrement: () => void;
|
|
14
|
+
}
|
|
15
|
+
// ==============================================================
|
|
16
|
+
|
|
17
|
+
export default function AddToCartButton({
|
|
18
|
+
quantity,
|
|
19
|
+
handleDecrement,
|
|
20
|
+
handleIncrement,
|
|
21
|
+
}: Props) {
|
|
22
|
+
return (
|
|
23
|
+
<FlexBox mt={1} flexShrink={0}>
|
|
24
|
+
{quantity ? (
|
|
25
|
+
<FlexBetween>
|
|
26
|
+
<Button
|
|
27
|
+
color="primary"
|
|
28
|
+
variant="contained"
|
|
29
|
+
sx={{ padding: 0.5, minHeight: 0 }}
|
|
30
|
+
onClick={handleIncrement}
|
|
31
|
+
>
|
|
32
|
+
<Add fontSize="small" />
|
|
33
|
+
</Button>
|
|
34
|
+
|
|
35
|
+
<H5 fontWeight="600" fontSize="15px" mx={1.5}>
|
|
36
|
+
{quantity}
|
|
37
|
+
</H5>
|
|
38
|
+
|
|
39
|
+
<Button
|
|
40
|
+
color="primary"
|
|
41
|
+
variant="contained"
|
|
42
|
+
sx={{ padding: 0.5, minHeight: 0 }}
|
|
43
|
+
onClick={handleDecrement}
|
|
44
|
+
>
|
|
45
|
+
<Remove fontSize="small" />
|
|
46
|
+
</Button>
|
|
47
|
+
</FlexBetween>
|
|
48
|
+
) : (
|
|
49
|
+
<Button
|
|
50
|
+
color="primary"
|
|
51
|
+
variant="contained"
|
|
52
|
+
onClick={handleIncrement}
|
|
53
|
+
sx={{ padding: 0.5, minHeight: 0 }}
|
|
54
|
+
>
|
|
55
|
+
<Add fontSize="small" />
|
|
56
|
+
</Button>
|
|
57
|
+
)}
|
|
58
|
+
</FlexBox>
|
|
59
|
+
);
|
|
60
|
+
}
|
package/src/components/_components/product-cards/product-card-9/components/favorite-button.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import styled from "@mui/material/styles/styled";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
|
|
4
|
+
// STYLED COMPONENTS
|
|
5
|
+
const StyledRoot = styled("div")(({ theme }) => ({
|
|
6
|
+
display: "flex",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
gap: theme.spacing(1),
|
|
9
|
+
"& p": {
|
|
10
|
+
fontSize: 11,
|
|
11
|
+
fontWeight: 700,
|
|
12
|
+
display: "inline-block",
|
|
13
|
+
textDecoration: "underline",
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
// ==============================================================
|
|
18
|
+
interface Props {
|
|
19
|
+
tags: string[];
|
|
20
|
+
}
|
|
21
|
+
// ==============================================================
|
|
22
|
+
|
|
23
|
+
export default function ProductTags({ tags }: Props) {
|
|
24
|
+
return (
|
|
25
|
+
<StyledRoot>
|
|
26
|
+
{tags.map((item) => (
|
|
27
|
+
<Link href="#" key={item}>
|
|
28
|
+
<p>{item}</p>
|
|
29
|
+
</Link>
|
|
30
|
+
))}
|
|
31
|
+
</StyledRoot>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ProductCard9 } from "./product-card";
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import Card from "@mui/material/Card";
|
|
3
|
+
import Rating from "@mui/material/Rating";
|
|
4
|
+
import styled from "@mui/material/styles/styled";
|
|
5
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
6
|
+
import { H5 } from "@/components/_components/Typography";
|
|
7
|
+
import ImageWithFallback from "../../../ImageWithFallback";
|
|
8
|
+
// LOCAL CUSTOM HOOK
|
|
9
|
+
import useProduct from "../use-product";
|
|
10
|
+
// LOCAL CUSTOM COMPONENTS
|
|
11
|
+
import DiscountChip from "../discount-chip";
|
|
12
|
+
import ProductPrice from "../product-price";
|
|
13
|
+
// import ProductTags from "./components/tags";
|
|
14
|
+
import AddToCartButton from "./components/add-to-cart";
|
|
15
|
+
import FavoriteButton from "./components/favorite-button";
|
|
16
|
+
|
|
17
|
+
import buildDetailUrl from "@/lib/build-detail-url";
|
|
18
|
+
|
|
19
|
+
// STYLED COMPONENT
|
|
20
|
+
const Wrapper = styled(Card)({
|
|
21
|
+
width: "100%",
|
|
22
|
+
overflow: "hidden",
|
|
23
|
+
position: "relative",
|
|
24
|
+
marginBottom: "1.25rem",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const ContentWrapper = styled("div")(({ theme }) => ({
|
|
28
|
+
display: "flex",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
flexDirection: "row",
|
|
31
|
+
|
|
32
|
+
"& .img-wrapper": {
|
|
33
|
+
width: 150,
|
|
34
|
+
height: 150,
|
|
35
|
+
flexShrink: 0,
|
|
36
|
+
position: "relative",
|
|
37
|
+
backgroundColor: theme.palette.grey[200],
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
"& .content": {
|
|
41
|
+
flex: 1,
|
|
42
|
+
padding: "1rem",
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "flex-end",
|
|
45
|
+
justifyContent: "space-between",
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
[theme.breakpoints.down("sm")]: {
|
|
49
|
+
flexDirection: "column",
|
|
50
|
+
alignItems: "flex-start",
|
|
51
|
+
"& .img-wrapper": { width: "100%" },
|
|
52
|
+
"& .content": { width: "100%" },
|
|
53
|
+
},
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
// ===========================================================
|
|
57
|
+
type Props = {
|
|
58
|
+
id: number;
|
|
59
|
+
off?: number;
|
|
60
|
+
slug: string;
|
|
61
|
+
price: number;
|
|
62
|
+
title: string;
|
|
63
|
+
imgUrl: string;
|
|
64
|
+
rating: number;
|
|
65
|
+
// show or hide
|
|
66
|
+
showAddToCart?: boolean;
|
|
67
|
+
showFavorite?: boolean;
|
|
68
|
+
};
|
|
69
|
+
// ===========================================================
|
|
70
|
+
|
|
71
|
+
export default function ProductCard9(props: Props) {
|
|
72
|
+
const {
|
|
73
|
+
imgUrl,
|
|
74
|
+
title,
|
|
75
|
+
price,
|
|
76
|
+
off,
|
|
77
|
+
rating,
|
|
78
|
+
id,
|
|
79
|
+
slug,
|
|
80
|
+
showAddToCart = true,
|
|
81
|
+
showFavorite = true,
|
|
82
|
+
} = props || {};
|
|
83
|
+
|
|
84
|
+
const { cartItem, handleCartAmountChange, isFavorite, toggleFavorite } =
|
|
85
|
+
useProduct(slug);
|
|
86
|
+
|
|
87
|
+
const handleIncrementQuantity = () => {
|
|
88
|
+
const product = {
|
|
89
|
+
id,
|
|
90
|
+
slug,
|
|
91
|
+
price,
|
|
92
|
+
imgUrl,
|
|
93
|
+
name: title,
|
|
94
|
+
qty: (cartItem?.Quantity || 0) + 1,
|
|
95
|
+
};
|
|
96
|
+
product;
|
|
97
|
+
handleCartAmountChange();
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const handleDecrementQuantity = () => {
|
|
101
|
+
const product = {
|
|
102
|
+
id,
|
|
103
|
+
slug,
|
|
104
|
+
price,
|
|
105
|
+
imgUrl,
|
|
106
|
+
name: title,
|
|
107
|
+
qty: (cartItem?.Quantity || 0) - 1,
|
|
108
|
+
};
|
|
109
|
+
product;
|
|
110
|
+
handleCartAmountChange("remove");
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Wrapper>
|
|
115
|
+
{/* PRODUCT FAVORITE BUTTON */}
|
|
116
|
+
{showFavorite && (
|
|
117
|
+
<FavoriteButton
|
|
118
|
+
isFavorite={isFavorite}
|
|
119
|
+
toggleFavorite={toggleFavorite}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
<ContentWrapper>
|
|
124
|
+
<div className="img-wrapper">
|
|
125
|
+
{/* DISCOUNT PERCENT CHIP IF AVAILABLE */}
|
|
126
|
+
<DiscountChip discount={off ?? 0} />
|
|
127
|
+
|
|
128
|
+
{/* PRODUCT IMAGE / THUMBNAIL */}
|
|
129
|
+
<ImageWithFallback
|
|
130
|
+
alt={title ?? "Product Image"}
|
|
131
|
+
src={imgUrl}
|
|
132
|
+
fill
|
|
133
|
+
style={{ objectFit: "contain" }}
|
|
134
|
+
sizes="150px"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<div className="content">
|
|
139
|
+
<div>
|
|
140
|
+
{/* PRODUCT TAG LIST */}
|
|
141
|
+
{/* <ProductTags tags={["Bike", "Motor", "Ducati"]} /> */}
|
|
142
|
+
|
|
143
|
+
{/* PRODUCT TITLE / NAME */}
|
|
144
|
+
<Link href={buildDetailUrl(title ?? "", id)}>
|
|
145
|
+
<H5 fontWeight="700" mt={1} mb={2}>
|
|
146
|
+
{title}
|
|
147
|
+
</H5>
|
|
148
|
+
</Link>
|
|
149
|
+
|
|
150
|
+
{/* PRODUCT RATING / REVIEW */}
|
|
151
|
+
<Rating size="small" value={rating} color="warn" readOnly />
|
|
152
|
+
|
|
153
|
+
{/* PRODUCT PRICE */}
|
|
154
|
+
<ProductPrice price={price} discount={off ?? 0} />
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
{/* PRODUCT ADD TO CART BUTTON */}
|
|
158
|
+
{showAddToCart && (
|
|
159
|
+
<AddToCartButton
|
|
160
|
+
quantity={cartItem?.Quantity ?? 0}
|
|
161
|
+
handleDecrement={handleDecrementQuantity}
|
|
162
|
+
handleIncrement={handleIncrementQuantity}
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
165
|
+
</div>
|
|
166
|
+
</ContentWrapper>
|
|
167
|
+
</Wrapper>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Box from "@mui/material/Box";
|
|
2
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
3
|
+
import FlexBox from "@/components/_components/flex-box/flex-box";
|
|
4
|
+
import { Paragraph } from "@/components/_components/Typography";
|
|
5
|
+
// CUSTOM UTILS LIBRARY FUNCTIONS
|
|
6
|
+
import { calculateDiscount, currency } from "@/lib/lib";
|
|
7
|
+
|
|
8
|
+
// ==============================================================
|
|
9
|
+
type Props = { price: number; discount: number };
|
|
10
|
+
// ==============================================================
|
|
11
|
+
|
|
12
|
+
export default function ProductPrice({ discount, price }: Props) {
|
|
13
|
+
return (
|
|
14
|
+
<FlexBox alignItems="center" gap={1} mt={0.5}>
|
|
15
|
+
<Paragraph fontWeight={600} color="primary.main">
|
|
16
|
+
{calculateDiscount(price, discount)}
|
|
17
|
+
</Paragraph>
|
|
18
|
+
|
|
19
|
+
{discount ? (
|
|
20
|
+
<Box component="del" fontWeight={600} color="grey.600">
|
|
21
|
+
{currency(price)}
|
|
22
|
+
</Box>
|
|
23
|
+
) : null}
|
|
24
|
+
</FlexBox>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Rating from "@mui/material/Rating";
|
|
2
|
+
import { BoxProps } from "@mui/material/Box";
|
|
3
|
+
// GLOBAL CUSTOM COMPONENTS
|
|
4
|
+
import { Span } from "@/components/_components/Typography";
|
|
5
|
+
import FlexBox from "@/components/_components/flex-box/flex-box";
|
|
6
|
+
|
|
7
|
+
// ==============================================================
|
|
8
|
+
interface Props extends BoxProps {
|
|
9
|
+
rating: number;
|
|
10
|
+
showRating: boolean;
|
|
11
|
+
}
|
|
12
|
+
// ==============================================================
|
|
13
|
+
|
|
14
|
+
export default function ProductRating({
|
|
15
|
+
showRating,
|
|
16
|
+
rating = 0,
|
|
17
|
+
...props
|
|
18
|
+
}: Props) {
|
|
19
|
+
if (showRating) {
|
|
20
|
+
return (
|
|
21
|
+
<FlexBox gap={1} alignItems="center" {...props}>
|
|
22
|
+
<Rating size="small" value={rating} color="warn" readOnly />
|
|
23
|
+
<Span color="grey.600">({rating})</Span>
|
|
24
|
+
</FlexBox>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
import { H3 } from "@/components/_components/Typography";
|
|
3
|
+
|
|
4
|
+
// ==============================================================
|
|
5
|
+
type Props = { title: string; slug: string };
|
|
6
|
+
// ==============================================================
|
|
7
|
+
|
|
8
|
+
export default function ProductTitle({ title, slug }: Props) {
|
|
9
|
+
return (
|
|
10
|
+
<Link href={`/products/${slug}`}>
|
|
11
|
+
<H3
|
|
12
|
+
mb={1}
|
|
13
|
+
ellipsis
|
|
14
|
+
title={title}
|
|
15
|
+
fontSize={14}
|
|
16
|
+
fontWeight={600}
|
|
17
|
+
className="title"
|
|
18
|
+
color="text.secondary"
|
|
19
|
+
>
|
|
20
|
+
{title}
|
|
21
|
+
</H3>
|
|
22
|
+
</Link>
|
|
23
|
+
);
|
|
24
|
+
}
|