Skip to content

Commit

Permalink
fix(sidenav): reintroduce support for slotted label content
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Aug 31, 2023
1 parent 5f8725e commit 26c7e6e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/sidenav/src/SidenavItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ export class SideNavItem extends LikeAnchor(Focusable) {
)}
>
<slot name="icon"></slot>
<span id="link-text">${this.label}</span>
<span id="link-text">
${this.label}
<slot></slot>
</span>
</a>
${this.expanded
? html`
Expand Down
28 changes: 28 additions & 0 deletions packages/sidenav/stories/sidenav.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,34 @@ export const Multilevel = ({

Multilevel.storyName = 'Multi-level';

export const MultilevelSlotted = ({
onChange,
}: {
onChange: () => void;
}): TemplateResult => {
return html`
<sp-sidenav variant="multilevel" value="2.3.1" @change=${onChange}>
<sp-sidenav-item value="foo">foo</sp-sidenav-item>
<sp-sidenav-item value="baz">
baz
<sp-sidenav-item value="2.1">2.1</sp-sidenav-item>
<sp-sidenav-item value="2.2">2.2</sp-sidenav-item>
<sp-sidenav-item value="2.3">
2.3
<sp-sidenav-item value="2.3.1">2.3.1</sp-sidenav-item>
<sp-sidenav-item disabled value="2.3.2">
2.3.2
</sp-sidenav-item>
</sp-sidenav-item>
</sp-sidenav-item>
<sp-sidenav-item value="test">test</sp-sidenav-item>
<sp-sidenav-item value="hi">hi</sp-sidenav-item>
</sp-sidenav>
`;
};

MultilevelSlotted.storyName = 'Multi-level Slotted';

export const levelsAndDisabled = (): TemplateResult => {
return html`
<sp-sidenav>
Expand Down

0 comments on commit 26c7e6e

Please sign in to comment.