Esteves Enzo
GET methods are working. WIP
6294700
raw
history blame
864 Bytes
"use client";
import { useState } from "react";
import { useMount } from "react-use";
import { EditorHeader } from "./header";
import { EditorSidebar } from "./sidebar";
import { usePathname } from "next/navigation";
export const Editor = ({ children }: any) => {
const [collections, setCollections] = useState<string[]>([]);
const pathname = usePathname();
useMount(() => {
if (!pathname || pathname === "/") setCollections(["search"]);
const firstPath = pathname.split("/")[1];
if (firstPath) setCollections([firstPath]);
});
return (
<div className="bg-slate-950 w-full overflow-hidden shadow-xl h-[100vh]">
<EditorHeader />
<main className="flex h-full">
<EditorSidebar
collections={collections}
onCollections={setCollections}
/>
{children}
</main>
</div>
);
};