Skip to content

Commit

Permalink
Tweak sidebar preview update
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis committed Jul 3, 2024
1 parent ee31535 commit 0eb43b6
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions docs/src/components/sidebar-preview.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
---
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';
interface Props {
config: SidebarConfig;
}
type SidebarConfig = Exclude<SidebarItem, AutoSidebarGroup>[];
type SidebarConfig = Exclude<SidebarItem, AutoSidebarGroup | InternalSidebarLinkItem>[];
const { config } = Astro.props;
Expand All @@ -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,
Expand Down

0 comments on commit 0eb43b6

Please sign in to comment.