diff --git a/components/menu.tsx b/components/menu.tsx index b39f5e3..7ce8866 100644 --- a/components/menu.tsx +++ b/components/menu.tsx @@ -6,10 +6,17 @@ import { } from "@/components/ui/menubar"; import { ModeToggle } from "./mode-toggle"; import Modal from "./modal"; +import { TemplatesMenu } from "./templates-menu"; export function MenubarComponent() { return ( + + New + + + + Theme diff --git a/components/templates-menu.tsx b/components/templates-menu.tsx new file mode 100644 index 0000000..20cc595 --- /dev/null +++ b/components/templates-menu.tsx @@ -0,0 +1,29 @@ +import * as React from "react"; + +import { MenubarRadioGroup, MenubarRadioItem } from "@/components/ui/menubar"; + +async function getData() { + let url = `https://playground-next.test.aelf.dev/playground/templates`; + if (process.env.NODE_ENV === "production") { + url = `/playground/templates`; + } + + const res = await fetch(url); + const data = await res.json(); + + return data as string[]; +} + +export async function TemplatesMenu() { + const data = await getData(); + + return ( + + {data.map((i) => ( + + {i} + + ))} + + ); +}