import { ArrowLeft } from 'lucide-react' import Link from 'next/link' import { PropsWithChildren, ReactNode } from 'react' import { cn } from 'ui' import type { SidebarSection } from './AccountLayout.types' import { getActiveKey, toSubMenuSections } from './AccountLayout.utils' import { SubMenu } from '@/components/ui/ProductMenu/SubMenu' interface WithSidebarProps { title?: string sections: SidebarSection[] header?: ReactNode backToDashboardURL?: string } export const WithSidebar = ({ title, header, children, sections, backToDashboardURL, }: PropsWithChildren) => { const noContent = !sections return (
{!noContent && ( )}
{children}
) } export const SidebarContent = ({ header, sections, backToDashboardURL, className, }: PropsWithChildren> & { className?: string }) => { const page = getActiveKey(sections) const subMenuSections = toSubMenuSections(sections) return ( <>
{backToDashboardURL && (
Back to dashboard
)} {header && header}
) }