From 0eb43b6b478835ff9ffc549d173a659a3a8d3147 Mon Sep 17 00:00:00 2001 From: Chris Swithinbank Date: Thu, 4 Jul 2024 01:20:32 +0200 Subject: [PATCH] Tweak sidebar preview update --- docs/src/components/sidebar-preview.astro | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/docs/src/components/sidebar-preview.astro b/docs/src/components/sidebar-preview.astro index 88dd571e94..810ac1cc92 100644 --- a/docs/src/components/sidebar-preview.astro +++ b/docs/src/components/sidebar-preview.astro @@ -1,5 +1,9 @@ --- -import type { AutoSidebarGroup, SidebarItem } from '../../../packages/starlight/schemas/sidebar'; +import type { + AutoSidebarGroup, + SidebarItem, + InternalSidebarLinkItem, +} from '../../../packages/starlight/schemas/sidebar'; import SidebarSublist from '../../../packages/starlight/components/SidebarSublist.astro'; import type { SidebarEntry } from '../../../packages/starlight/utils/navigation'; @@ -7,7 +11,7 @@ interface Props { config: SidebarConfig; } -type SidebarConfig = Exclude[]; +type SidebarConfig = Exclude[]; const { config } = Astro.props; @@ -27,20 +31,6 @@ function makeEntries(items: SidebarConfig): SidebarEntry[] { }; } - if ('slug' in item) { - return { - type: 'link', - label: item.slug, - // Empty hrefs are used to represent internal links that do not exist in the Starlight - // docs. Using a non-existing anchor link like `#_` will not trigger a page reload or any - // scrolling. - href: item.slug, - isCurrent: false, - badge: item.badge, - attrs: item.attrs ?? {}, - }; - } - return { type: 'group', label: item.label,