'use client'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { ReactNode } from 'react'; import { TOOLS } from '../../constants/tools'; import { theme } from '../../stitches.config'; interface ToolsLayoutProps { children: ReactNode; } export default function ToolsLayout({ children }: ToolsLayoutProps) { const pathname = usePathname(); const pathSplit = pathname.split('/'); const toolId = pathSplit.at(2); const isToolRoot = pathname === `/tools/${toolId}`; const tool = TOOLS.find((tool) => tool.id === toolId); return ( <> {tool && ( <> {isToolRoot && ( <> {tool.title} {tool.pageDescription !== undefined && ( <> )} )} )} {pathSplit.length === 3 && (
{tool?.title} {tool?.description}
)} {children} ); }