refactor: more toc

This commit is contained in:
hypercross 2026-03-25 11:00:32 +08:00
parent a7477666c7
commit 33d29252dc
1 changed files with 11 additions and 9 deletions

View File

@ -111,19 +111,21 @@ export const HeadingNode: Component<{
return ( return (
<div> <div>
<span class={`${hasChildren ? "" : "invisible" } ${isExpanded() ? "rotate-90" : ""} inline-block transition-transform cursor-pointer mr-1 text-gray-400 text-xs w-3 flex-shrink-0`} <div class="flex flex-row">
<span class={`cursor-pointer mr-1 text-gray-400 text-xs w-3 flex-shrink-0`}
style={{ "margin-left": `${indent + 8}px` }} style={{ "margin-left": `${indent + 8}px` }}
onClick={handleExpand} onClick={handleExpand}
> >
<span class={`${hasChildren ? "" : "invisible" } ${isExpanded() ? "rotate-90" : ""} mt-1 inline-block transition-transform `}></span>
</span> </span>
<a <a
href={href} href={href}
class="inline-flex items-center py-0.5 px-2 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-50 rounded truncate cursor-pointer" class="inline-flex items-center py-0.5 px-2 text-sm text-gray-600 hover:text-gray-900 hover:bg-gray-50 rounded truncate cursor-pointer"
onClick={handleClick} onClick={handleClick}
> >
<span class="truncate">{props.node.title}</span> {props.node.title}
</a> </a>
</div>
<Show when={hasChildren && isExpanded()}> <Show when={hasChildren && isExpanded()}>
<div> <div>
{props.node.children!.map((child) => ( {props.node.children!.map((child) => (