diff --git a/public/hamburger-menu.json b/public/hamburger-menu.json new file mode 100644 index 00000000..6538aa0a --- /dev/null +++ b/public/hamburger-menu.json @@ -0,0 +1,395 @@ +{ + "nm": "Main Scene", + "ddd": 0, + "h": 667, + "w": 375, + "meta": { "g": "@lottiefiles/creator 1.82.0" }, + "layers": [ + { + "ty": 4, + "nm": "Top", + "sr": 1, + "st": 0, + "op": 300, + "ip": 0, + "hd": false, + "ddd": 0, + "bm": 0, + "hasMask": false, + "ao": 0, + "ks": { + "a": { "a": 0, "k": [0, 0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, + "sk": { "a": 0, "k": 0 }, + "p": { + "a": 1, + "k": [ + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [187.5, 282.993], + "t": 0 + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [187.5, 332.993, 0], + "t": 15, + "ti": [0, 0.165, 0], + "to": [0, -0.118, 0] + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [187.5, 332.993, 0], + "t": 58, + "ti": [0, 0.319, 0], + "to": [0, -0.118, 0] + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [187.5, 333, 0], + "t": 60, + "ti": [0, 2.29, 0], + "to": [0, -5.714, 0] + }, + { "s": [187.5, 283, 0], "t": 75 } + ], + "ix": 2 + }, + "r": { + "a": 1, + "k": [ + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [0], + "t": 15 + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [45], + "t": 30 + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [45], + "t": 45 + }, + { "s": [0], "t": 60 } + ], + "ix": 10 + }, + "sa": { "a": 0, "k": 0 }, + "o": { "a": 0, "k": 100, "ix": 11 } + }, + "shapes": [ + { + "ty": "gr", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Group", + "nm": "Top", + "ix": 1, + "cix": 2, + "np": 2, + "it": [ + { + "ty": "sh", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Shape - Group", + "nm": "Path 1", + "ix": 1, + "d": 1, + "ks": { + "a": 0, + "k": { + "c": false, + "i": [[0, 0], [0, 0]], + "o": [[0, 0], [0, 0]], + "v": [[-80.5, 0], [80.5, 0]] + }, + "ix": 2 + } + }, + { + "ty": "st", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Graphic - Stroke", + "nm": "Stroke 1", + "lc": 2, + "lj": 1, + "ml": 4, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 16, "ix": 5 }, + "c": { "a": 0, "k": [0, 0, 0], "ix": 3 } + }, + { + "ty": "tr", + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, + "o": { "a": 0, "k": 100, "ix": 7 } + } + ] + } + ], + "ind": 1 + }, + { + "ty": 4, + "nm": "Middle", + "sr": 1, + "st": 0, + "op": 300, + "ip": 0, + "hd": false, + "ddd": 0, + "bm": 0, + "hasMask": false, + "ao": 0, + "ks": { + "a": { "a": 0, "k": [0, 0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, + "sk": { "a": 0, "k": 0 }, + "p": { "a": 0, "k": [187.5, 332.993], "ix": 2 }, + "r": { "a": 0, "k": 0, "ix": 10 }, + "sa": { "a": 0, "k": 0 }, + "o": { + "a": 1, + "k": [ + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [100], + "t": 13 + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [0], + "t": 15 + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [0], + "t": 60 + }, + { "s": [100], "t": 62 } + ], + "ix": 11 + } + }, + "shapes": [ + { + "ty": "gr", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Group", + "nm": "Middle", + "ix": 1, + "cix": 2, + "np": 2, + "it": [ + { + "ty": "sh", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Shape - Group", + "nm": "Path 1", + "ix": 1, + "d": 1, + "ks": { + "a": 0, + "k": { + "c": false, + "i": [[0, 0], [0, 0]], + "o": [[0, 0], [0, 0]], + "v": [[-80.5, 0], [80.5, 0]] + }, + "ix": 2 + } + }, + { + "ty": "st", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Graphic - Stroke", + "nm": "Stroke 1", + "lc": 2, + "lj": 1, + "ml": 4, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 16, "ix": 5 }, + "c": { "a": 0, "k": [0, 0, 0], "ix": 3 } + }, + { + "ty": "tr", + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, + "o": { "a": 0, "k": 100, "ix": 7 } + } + ] + } + ], + "ind": 2 + }, + { + "ty": 4, + "nm": "Bottom", + "sr": 1, + "st": 0, + "op": 300, + "ip": 0, + "hd": false, + "ddd": 0, + "bm": 0, + "hasMask": false, + "ao": 0, + "ks": { + "a": { "a": 0, "k": [0, 0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, + "sk": { "a": 0, "k": 0 }, + "p": { + "a": 1, + "k": [ + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [187.5, 382.993], + "t": 0 + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [187.5, 333, 0], + "t": 15, + "ti": [0, -0.001, 0], + "to": [0, 0.001, 0] + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [187.5, 333, 0], + "t": 58, + "ti": [0, -0.7, 0], + "to": [0, 0.001, 0] + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [187.5, 333, 0], + "t": 60, + "ti": [0, -2.242, 0], + "to": [0, 5.605, 0] + }, + { "s": [187.5, 383, 0], "t": 75 } + ], + "ix": 2 + }, + "r": { + "a": 1, + "k": [ + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [0], + "t": 15 + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [-45], + "t": 30 + }, + { + "o": { "x": 0.333, "y": 0 }, + "i": { "x": 0.667, "y": 1 }, + "s": [-45], + "t": 45 + }, + { "s": [0], "t": 60 } + ], + "ix": 10 + }, + "sa": { "a": 0, "k": 0 }, + "o": { "a": 0, "k": 100, "ix": 11 } + }, + "shapes": [ + { + "ty": "gr", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Group", + "nm": "Bottom", + "ix": 1, + "cix": 2, + "np": 2, + "it": [ + { + "ty": "sh", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Shape - Group", + "nm": "Path 1", + "ix": 1, + "d": 1, + "ks": { + "a": 0, + "k": { + "c": false, + "i": [[0, 0], [0, 0]], + "o": [[0, 0], [0, 0]], + "v": [[-80.5, 0], [80.5, 0]] + }, + "ix": 2 + } + }, + { + "ty": "st", + "bm": 0, + "hd": false, + "mn": "ADBE Vector Graphic - Stroke", + "nm": "Stroke 1", + "lc": 2, + "lj": 1, + "ml": 4, + "o": { "a": 0, "k": 100, "ix": 4 }, + "w": { "a": 0, "k": 16, "ix": 5 }, + "c": { "a": 0, "k": [0, 0, 0], "ix": 3 } + }, + { + "ty": "tr", + "a": { "a": 0, "k": [0, 0], "ix": 1 }, + "s": { "a": 0, "k": [100, 100], "ix": 3 }, + "sk": { "a": 0, "k": 0, "ix": 4 }, + "p": { "a": 0, "k": [0, 0], "ix": 2 }, + "r": { "a": 0, "k": 0, "ix": 6 }, + "sa": { "a": 0, "k": 0, "ix": 5 }, + "o": { "a": 0, "k": 100, "ix": 7 } + } + ] + } + ], + "ind": 3 + } + ], + "v": "5.7.0", + "fr": 60, + "op": 97, + "ip": 0, + "assets": [] +} diff --git a/public/hamburger-menu.lottie b/public/hamburger-menu.lottie new file mode 100644 index 00000000..97f7a91a Binary files /dev/null and b/public/hamburger-menu.lottie differ diff --git a/src/app/[country]/[locale]/(storefront)/layout.tsx b/src/app/[country]/[locale]/(storefront)/layout.tsx index 3a9b372b..37ec088b 100644 --- a/src/app/[country]/[locale]/(storefront)/layout.tsx +++ b/src/app/[country]/[locale]/(storefront)/layout.tsx @@ -1,21 +1,58 @@ +import type { Category } from "@spree/sdk"; import { Footer } from "@/components/layout/Footer"; import { Header } from "@/components/layout/Header"; import { getCategories } from "@/lib/data/categories"; interface StorefrontLayoutProps { children: React.ReactNode; + params: Promise<{ country: string; locale: string }>; +} + +function CategoryLinks({ + categories, + basePath, +}: { + categories: Category[]; + basePath: string; +}) { + return ( + + ); } export default async function StorefrontLayout({ children, + params, }: StorefrontLayoutProps) { - const rootCategories = await getCategories({ depth_eq: 0 }) + const { country, locale } = await params; + const basePath = `/${country}/${locale}`; + + const rootCategories = await getCategories({ + depth_eq: 0, + expand: ["children.children"], + }) .then((res) => res.data) .catch(() => []); + const menuCategories = rootCategories.flatMap((root) => root.children ?? []); + return ( <>
+ {menuCategories.length > 0 && ( + + )}
{children}