Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/remove-toc-sidebar-wrapper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ainsleydev/sveltekit-helper": patch
---

Remove `<Sidebar>` wrapper from `TableOfContents` — consumers should wrap it themselves.
45 changes: 21 additions & 24 deletions packages/sveltekit-helper/src/components/TableOfContents.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export type TableOfContentsProps = {

<script lang="ts">
import { onMount } from 'svelte'
import Sidebar from './Sidebar.svelte'

let {
heading = '',
Expand Down Expand Up @@ -133,29 +132,27 @@ export type TableOfContentsProps = {
<TableOfContents items={[{ label: 'Intro', href: 'intro' }]} />
```
-->
<Sidebar>
<div class="toc" class:toc--border={displayBorder}>
{#if heading !== ''}
<p class="toc__heading">
{heading}
</p>
{/if}
<menu class="toc__items">
{#each items as item, index (index)}
<li class="toc__item">
<a
class="toc__link"
class:toc__link--active={activeId ===
(item.href.startsWith('#') ? item.href.slice(1) : item.href)}
href="#{item.href}"
>
<small>{item.label}</small>
</a>
</li>
{/each}
</menu>
</div>
</Sidebar>
<div class="toc" class:toc--border={displayBorder}>
{#if heading !== ''}
<p class="toc__heading">
{heading}
</p>
{/if}
<menu class="toc__items">
{#each items as item, index (index)}
<li class="toc__item">
<a
class="toc__link"
class:toc__link--active={activeId ===
(item.href.startsWith('#') ? item.href.slice(1) : item.href)}
href="#{item.href}"
>
<small>{item.label}</small>
</a>
</li>
{/each}
</menu>
</div>

<style lang="scss">
@use '../scss' as a;
Expand Down
Loading