Skip to content

Commit ac3ba6d

Browse files
committed
propose heading indentation within metabar toc
1 parent 3e1c9cd commit ac3ba6d

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

apps/site/components/Containers/MetaBar/index.stories.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ export const Default: Story = {
7878
depth: 3,
7979
data: { id: 'contact_and_future_updates' },
8080
},
81+
{
82+
value: 'Email',
83+
depth: 4,
84+
data: { id: 'email' },
85+
},
86+
{
87+
value: 'Slack',
88+
depth: 4,
89+
data: { id: 'slack' },
90+
},
91+
{
92+
value: '#node-website',
93+
depth: 5, // h5s do not get shown
94+
data: { id: 'node-website' },
95+
},
8196
],
8297
},
8398
},

apps/site/components/Containers/MetaBar/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ const MetaBar: FC<MetaBarProps> = ({ items, headings }) => {
4444
<dd>
4545
<ol>
4646
{heading.map(head => (
47-
<li key={head.value}>
48-
<Link href={`#${head?.data?.id}`}>{head.value}</Link>
47+
<li
48+
key={head.value}
49+
className={
50+
head.depth === 3 ? 'pl-2' : head.depth === 4 ? 'pl-4' : ''
51+
}
52+
>
53+
<Link href={`#${head?.data?.id}`}> {head.value}</Link>
4954
</li>
5055
))}
5156
</ol>

0 commit comments

Comments
 (0)