Skip to content

Commit

Permalink
refactor: destructure props in SidebarSublist.astro (withastro#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreyfus92 authored Nov 25, 2023
1 parent 6f101c8 commit 14f9dbd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/starlight/components/SidebarSublist.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ interface Props {
sublist: SidebarEntry[];
nested?: boolean;
}
const { sublist, nested } = Astro.props;
---

<ul class:list={{ 'top-level': !Astro.props.nested }}>
<ul class:list={{ 'top-level': !nested }}>
{
Astro.props.sublist.map((entry) => (
sublist.map((entry) => (
<li>
{entry.type === 'link' ? (
<a
href={entry.href}
aria-current={entry.isCurrent && 'page'}
class:list={[{ large: !Astro.props.nested }, entry.attrs.class]}
class:list={[{ large: !nested }, entry.attrs.class]}
{...entry.attrs}
>
<span>{entry.label}</span>
Expand Down

0 comments on commit 14f9dbd

Please sign in to comment.