@pradip1995/layout-default 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +41 -0
- package/src/cart-layout.tsx +18 -0
- package/src/index.ts +2 -0
- package/src/layout.tsx +13 -0
- package/src/manifest.ts +10 -0
- package/src/shell.tsx +59 -0
- package/src/store-layout.tsx +21 -0
- package/src/wishlist-layout.tsx +18 -0
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pradip1995/layout-default",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"files": [
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./src/index.ts",
|
|
14
|
+
"./shell": "./src/shell.tsx",
|
|
15
|
+
"./store": "./src/store-layout.tsx",
|
|
16
|
+
"./cart": "./src/cart-layout.tsx",
|
|
17
|
+
"./wishlist": "./src/wishlist-layout.tsx",
|
|
18
|
+
"./manifest": "./src/manifest.ts"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@pradip1995/plugin-sdk": "^0.2.0",
|
|
22
|
+
"react": ">=19"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@pradip1995/segment-footer": "0.2.0",
|
|
26
|
+
"@pradip1995/segment-nav": "0.2.0",
|
|
27
|
+
"@pradip1995/segment-primitives": "0.2.0",
|
|
28
|
+
"@pradip1995/segment-tokens": "0.2.0",
|
|
29
|
+
"@pradip1995/segment-promo-bar": "0.2.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@pradip1995/plugin-sdk": "^0.2.0",
|
|
33
|
+
"@types/react": "^19",
|
|
34
|
+
"react": "19.0.3",
|
|
35
|
+
"typescript": "^5.7.2"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"lint": "tsc --noEmit"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react"
|
|
2
|
+
import { StorefrontShell } from "./shell"
|
|
3
|
+
|
|
4
|
+
type LayoutProps = {
|
|
5
|
+
data: Record<string, unknown>
|
|
6
|
+
children: ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function LayoutCart({ data, children }: LayoutProps) {
|
|
10
|
+
return (
|
|
11
|
+
<StorefrontShell data={data} contained>
|
|
12
|
+
<div className="py-10 lg:py-14">
|
|
13
|
+
<h1 className="section-heading mb-8">Your cart</h1>
|
|
14
|
+
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8 lg:gap-10">{children}</div>
|
|
15
|
+
</div>
|
|
16
|
+
</StorefrontShell>
|
|
17
|
+
)
|
|
18
|
+
}
|
package/src/index.ts
ADDED
package/src/layout.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react"
|
|
2
|
+
import { StorefrontShell } from "./shell"
|
|
3
|
+
|
|
4
|
+
type LayoutProps = {
|
|
5
|
+
data: Record<string, unknown>
|
|
6
|
+
children: ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function LayoutDefault({ data, children }: LayoutProps) {
|
|
10
|
+
return <StorefrontShell data={data}>{children}</StorefrontShell>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { StorefrontShell } from "./shell"
|
package/src/manifest.ts
ADDED
package/src/shell.tsx
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ReactNode } from "react"
|
|
2
|
+
import type { HttpTypes } from "@medusajs/types"
|
|
3
|
+
import Nav from "@pradip1995/segment-nav"
|
|
4
|
+
import PromoBar from "@pradip1995/segment-promo-bar"
|
|
5
|
+
import Footer from "@pradip1995/segment-footer"
|
|
6
|
+
import type { FooterSlotData, NavSlotData, PromoBarSlotData } from "@pradip1995/plugin-sdk"
|
|
7
|
+
import { colorClasses } from "@pradip1995/segment-tokens"
|
|
8
|
+
|
|
9
|
+
type ShellProps = {
|
|
10
|
+
data: Record<string, unknown>
|
|
11
|
+
children: ReactNode
|
|
12
|
+
hidePromo?: boolean
|
|
13
|
+
hideFooter?: boolean
|
|
14
|
+
contained?: boolean
|
|
15
|
+
className?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function StorefrontShell({
|
|
19
|
+
data,
|
|
20
|
+
children,
|
|
21
|
+
hidePromo = false,
|
|
22
|
+
hideFooter = false,
|
|
23
|
+
contained = false,
|
|
24
|
+
className = "",
|
|
25
|
+
}: ShellProps) {
|
|
26
|
+
const nav = data.nav as NavSlotData & {
|
|
27
|
+
categories?: unknown[]
|
|
28
|
+
collections?: unknown[]
|
|
29
|
+
wishlistCount?: number
|
|
30
|
+
}
|
|
31
|
+
const promoBar = data.promoBar as PromoBarSlotData
|
|
32
|
+
const footer = data.footer as FooterSlotData
|
|
33
|
+
const cart = data.cart as HttpTypes.StoreCart | null | undefined
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div className={`${colorClasses.pageBg} min-h-screen flex flex-col font-sans antialiased ${className}`}>
|
|
37
|
+
{!hidePromo && promoBar && <PromoBar {...promoBar} />}
|
|
38
|
+
{nav && (
|
|
39
|
+
<Nav
|
|
40
|
+
{...nav}
|
|
41
|
+
categories={nav.categories}
|
|
42
|
+
collections={nav.collections}
|
|
43
|
+
wishlistCount={nav.wishlistCount}
|
|
44
|
+
cart={cart ?? null}
|
|
45
|
+
/>
|
|
46
|
+
)}
|
|
47
|
+
<div className="flex-1 w-full">
|
|
48
|
+
{contained ? (
|
|
49
|
+
<div className="mx-auto w-full px-4 sm:px-6" style={{ maxWidth: "var(--container-max)" }}>
|
|
50
|
+
{children}
|
|
51
|
+
</div>
|
|
52
|
+
) : (
|
|
53
|
+
children
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
{!hideFooter && footer && <Footer {...footer} />}
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react"
|
|
2
|
+
import { StorefrontShell } from "./shell"
|
|
3
|
+
|
|
4
|
+
type LayoutProps = {
|
|
5
|
+
data: Record<string, unknown>
|
|
6
|
+
children: ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Two-column PLP shell: filters + product grid */
|
|
10
|
+
export default function LayoutStore({ data, children }: LayoutProps) {
|
|
11
|
+
return (
|
|
12
|
+
<StorefrontShell data={data}>
|
|
13
|
+
<div
|
|
14
|
+
className="mx-auto flex flex-col lg:flex-row gap-8 lg:gap-12 px-4 sm:px-6 py-8 lg:py-12"
|
|
15
|
+
style={{ maxWidth: "var(--container-max)" }}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
</StorefrontShell>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react"
|
|
2
|
+
import { StorefrontShell } from "./shell"
|
|
3
|
+
|
|
4
|
+
type LayoutProps = {
|
|
5
|
+
data: Record<string, unknown>
|
|
6
|
+
children: ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default function LayoutWishlist({ data, children }: LayoutProps) {
|
|
10
|
+
return (
|
|
11
|
+
<StorefrontShell data={data} contained>
|
|
12
|
+
<div className="py-8 sm:py-12 md:py-14">
|
|
13
|
+
<h1 className="section-heading mb-2">My wishlist</h1>
|
|
14
|
+
{children}
|
|
15
|
+
</div>
|
|
16
|
+
</StorefrontShell>
|
|
17
|
+
)
|
|
18
|
+
}
|