Skip to content

Commit 273ef6c

Browse files
committed
minor fixes on toc
Signed-off-by: rishichawda <rishichawda@users.noreply.github.com>
1 parent 090d1ac commit 273ef6c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/article/table_of_contents.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type Props = {
66
};
77
88
const { headings } = Astro.props;
9-
let filteredHeadings = headings.filter((heading) => heading.depth <= (headings.length > 10 ? 2 : 4));
9+
let filteredHeadings = headings.filter((heading) => heading.depth <= (headings.length > 10 ? 3 : 4));
1010
---
1111

1212
<div class="lg:sticky top-4 py-4 max-w-xs max-h-[calc(100vh-2rem)] overflow-y-auto">
@@ -17,7 +17,7 @@ let filteredHeadings = headings.filter((heading) => heading.depth <= (headings.l
1717
filteredHeadings.map((item) => (
1818
<li
1919
class="list-none"
20-
style={`padding-left: ${(item.depth - 1) * 1.25}rem;`}
20+
style={`padding-left: ${(item.depth - 2) * 1.25}rem;`}
2121
aria-label={item.text}
2222
role="listitem"
2323
>
@@ -27,7 +27,7 @@ let filteredHeadings = headings.filter((heading) => heading.depth <= (headings.l
2727
href={`#${item.slug}`}
2828
>
2929
{/* Conditionally apply smaller text size for deeper levels */}
30-
<span class:list={["flex-1", item.depth > 2 ? "text-xs" : "text-sm"]} title={item.text}>
30+
<span class:list={["flex-1", item.depth > 3 ? "text-xs" : "text-sm"]} title={item.text}>
3131
{item.text}
3232
</span>
3333
</a>

0 commit comments

Comments
 (0)