@pradip1995/segment-product-card 0.3.27 → 0.3.28
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/package.json +1 -1
- package/src/segment.tsx +14 -2
package/package.json
CHANGED
package/src/segment.tsx
CHANGED
|
@@ -5,8 +5,10 @@ import type { HttpTypes } from "@medusajs/types"
|
|
|
5
5
|
import BeautyProductCard from "./beauty-product-card"
|
|
6
6
|
import DefaultProductCard from "./default-product-card"
|
|
7
7
|
import JewelryProductCard from "./jewelry-product-card"
|
|
8
|
+
import MotionProductCard from "./motion-product-card"
|
|
9
|
+
import ShopProductCard from "./shop-product-card"
|
|
8
10
|
|
|
9
|
-
export type ProductCardVariant = "default" | "beauty" | "jewelry"
|
|
11
|
+
export type ProductCardVariant = "default" | "beauty" | "jewelry" | "motion" | "shop"
|
|
10
12
|
|
|
11
13
|
type Props = {
|
|
12
14
|
product: HttpTypes.StoreProduct
|
|
@@ -19,7 +21,15 @@ type Props = {
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
function resolveProductCardVariant(variant?: ProductCardVariant): ProductCardVariant {
|
|
22
|
-
if (
|
|
24
|
+
if (
|
|
25
|
+
variant === "beauty" ||
|
|
26
|
+
variant === "default" ||
|
|
27
|
+
variant === "jewelry" ||
|
|
28
|
+
variant === "motion" ||
|
|
29
|
+
variant === "shop"
|
|
30
|
+
) {
|
|
31
|
+
return variant
|
|
32
|
+
}
|
|
23
33
|
return "default"
|
|
24
34
|
}
|
|
25
35
|
|
|
@@ -27,5 +37,7 @@ export default function ProductCard({ variant, ...props }: Props) {
|
|
|
27
37
|
const layout = resolveProductCardVariant(variant)
|
|
28
38
|
if (layout === "beauty") return <BeautyProductCard {...props} />
|
|
29
39
|
if (layout === "jewelry") return <JewelryProductCard {...props} />
|
|
40
|
+
if (layout === "motion") return <MotionProductCard {...props} />
|
|
41
|
+
if (layout === "shop") return <ShopProductCard {...props} />
|
|
30
42
|
return <DefaultProductCard {...props} />
|
|
31
43
|
}
|