1 import clsx from "clsx"
2 import RecipesSectionIcon from "./Icons/section"
3 import { HeadlineTags } from "docs-ui"
4 import RecipesMarketplaceIcon from "./Icons/marketplace"
5 import RecipesErpIcon from "./Icons/erp"
6 import RecipesBundledProductsIcon from "./Icons/bundled-products"
7 import RecipesSubscriptionsIcon from "./Icons/subscriptions"
8 import RecipesRestaurantIcon from "./Icons/restaurant"
9 import RecipesDigitalProductsIcon from "./Icons/digital-products"
10 import HomepageEdges from "../Edges"
11 import Link from "next/link"
12
13 type Card = {
14 title: string
15 description: string
16 link: string
17 icon: React.ReactNode
18 }
19
20 const HomepageRecipesSection = () => {
21 const cards: Card[] = [
22 {
23 title: "Marketplace",
24 description: "Build a marketplace with multiple vendors.",
25 link: "https://docs.medusajs.com/resources/recipes/marketplace/examples/vendors",
26 icon: (
27 <RecipesMarketplaceIcon className="text-medusa-fg-subtle group-hover:text-medusa-fg-interactive" />
28 ),
29 },
30 {
31 title: "ERP",
32 description:
33 "Integrate an ERP system to manage custom product prices, purchase rules, syncing orders, and more.",
34 link: "https://docs.medusajs.com/resources/recipes/erp",
35 icon: (
36 <RecipesErpIcon className="text-medusa-fg-subtle group-hover:text-medusa-fg-interactive" />
37 ),
38 },
39 {
40 title: "Bundled Products",
41 description:
42 "Sell products as bundles with Admin and storefront customizations.",
43 link: "https://docs.medusajs.com/resources/recipes/bundled-products/examples/standard",
44 icon: (
45 <RecipesBundledProductsIcon className="text-medusa-fg-subtle group-hover:text-medusa-fg-interactive" />
46 ),
47 },
48 {
49 title: "Subscriptions",
50 description: "Implement a subscription-based commerce store.",
51 link: "https://docs.medusajs.com/resources/recipes/subscriptions/examples/standard",
52 icon: (
53 <RecipesSubscriptionsIcon className="text-medusa-fg-subtle group-hover:text-medusa-fg-interactive" />
54 ),
55 },
56 {
57 title: "Restaurant-Delivery",
58 description:
59 "Build a restaurant marketplace inspired by UberEats, with real-time delivery handling.",
60 link: "https://docs.medusajs.com/resources/recipes/marketplace/examples/restaurant-delivery",
61 icon: (
62 <RecipesRestaurantIcon className="text-medusa-fg-subtle group-hover:text-medusa-fg-interactive" />
63 ),
64 },
65 {
66 title: "Digital Products",
67 description: "Sell digital products with custom fulfillment.",
68 link: "https://docs.medusajs.com/resources/recipes/digital-products/examples/standard",
69 icon: (
70 <RecipesDigitalProductsIcon className="text-medusa-fg-subtle group-hover:text-medusa-fg-interactive" />
71 ),
72 },
73 ]
74 return (
75 <div className="w-full border-b border-medusa-border-base">
76 <div className="flex flex-col md:flex-row gap-0 justify-center border-b border-medusa-border-base">
77 <div
78 className={clsx(
79 "w-full md:w-1/2 lg:w-1/3 bg-medusa-bg-component p-2",
80 "flex justify-center items-center",
81 "md:border-r border-medusa-border-base",
82 "border-b md:border-b-0"
83 )}
84 >
85 <RecipesSectionIcon />
86 </div>
87 <div
88 className={clsx(
89 "w-full md:w-1/2 lg:w-2/3 py-4 px-2",
90 "flex flex-col gap-0.75 justify-center"
91 )}
92 >
93 <HeadlineTags
94 tags={[
95 "Recipes",
96 {
97 text: "View all",
98 link: "https://docs.medusajs.com/resources/recipes",
99 },
100 ]}
101 className="!justify-start"
102 />
103 <h2 className="text-h1 text-medusa-fg-base lg:max-w-[450px]">
104 Medusa’s framework supports any business use case.
105 </h2>
106 <p className="txt-large text-medusa-fg-base">
107 These recipes show you how to build a use case by customizing and
108 extending existing data models and features, or creating new ones.
109 </p>
110 </div>
111 </div>
112 <div className="flex flex-wrap gap-0 flex-col sm:flex-row">
113 {cards.map((card, index) => (
114 <div
115 key={index}
116 className={clsx(
117 "w-full sm:w-1/2 md:w-1/3 p-2 flex gap-1 flex-col",
118 "border-b last:!border-b-0",
119 index >= 3 && "md:border-b-0",
120 index >= 4 && "sm:border-b-0",
121 index % 3 !== 2 && "border-r",
122 index === 2 && "border-r md:border-r-0",
123 "border-medusa-border-base",
124 "group relative"
125 )}
126 >
127 <div
128 className={clsx(
129 "!h-[2px] bg-medusa-fg-interactive opacity-0 group-hover:opacity-100",
130 "absolute -top-[2px] left-0 w-full transition-opacity duration-100"
131 )}
132 />
133 <div
134 className={clsx(
135 "bg-medusa-alphas-alpha-6 border border-medusa-border-base",
136 "w-3 h-3 flex justify-center items-center relative",
137 "group-hover:bg-transparent group-hover:border-transparent",
138 "transition-all duration-100"
139 )}
140 >
141 {card.icon}
142 <HomepageEdges className="group-hover:border-medusa-fg-interactive transition-colors duration-100" />
143 </div>
144 <div className="flex flex-col gap-0">
145 <h3 className="text-medium-plus text-medusa-fg-base">
146 {card.title}
147 </h3>
148 <p className="text-medium text-medusa-fg-subtle">
149 {card.description}
150 </p>
151 </div>
152 <Link
153 href={card.link}
154 className="absolute top-0 left-0 w-full h-full opacity-0"
155 >
156 Learn more
157 </Link>
158 </div>
159 ))}
160 </div>
161 </div>
162 )
163 }
164
165 export default HomepageRecipesSection