'use client'; //=========================================== // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template //=========================================== import { Button, Typography, cn } from '@hexclave/ui'; import { XIcon } from 'lucide-react'; import React, { ReactNode } from 'react'; import { useStackApp } from '../..'; import { suspendIfSsr } from '../../utils/react'; export type SidebarItem = { title: React.ReactNode, type: 'item' | 'divider', description?: React.ReactNode, id?: string, icon?: React.ReactNode, content?: React.ReactNode, contentTitle?: React.ReactNode, } function normalizeHash(hash: string) { return hash.startsWith("#") ? hash.slice(1) : hash; } function useHash() { suspendIfSsr(); return React.useSyncExternalStore( (onStoreChange) => { window.addEventListener("hashchange", onStoreChange); return () => window.removeEventListener("hashchange", onStoreChange); }, () => normalizeHash(window.location.hash), ); } export function SidebarLayout(props: { items: SidebarItem[], title?: ReactNode, className?: string }) { const hash = useHash(); const selectedIndex = props.items.findIndex(item => item.id && (item.id === hash)); return ( <>