"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 [open, setOpen] = useState(false); const [collections, setCollections] = useState([]); const pathname = usePathname(); useMount(() => { if (!pathname || pathname === "/") setCollections(["search"]); const firstPath = pathname.split("/")[1]; if (firstPath) setCollections([firstPath]); }); return (
setOpen(!open)} />
{children}
); };