Skip to content

Commit

Permalink
fix(tab): optional badge
Browse files Browse the repository at this point in the history
  • Loading branch information
megheaiulian committed May 18, 2022
1 parent 816992e commit 0c0ce5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/next/cosmoz-tab.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { html, component, useLayoutEffect } from 'haunted';
import { component, useLayoutEffect } from 'haunted';
import { html, nothing } from 'lit-html';
import { ifDefined } from 'lit-html/directives/if-defined';
import computeScroll from 'compute-scroll-into-view';

Expand Down Expand Up @@ -37,7 +38,9 @@ const Tab = (host) => {
<a part="link" href=${ifDefined(href)}>
<slot id="iconSlot" name="icon"></slot>
<slot id="contentSlot"></slot>
<span class="badge" part="badge">${badge}</span>
${badge
? html`<span class="badge" part="badge">${badge}</span>`
: nothing}
</a>
`;
};
Expand Down
5 changes: 1 addition & 4 deletions stories/cosmoz-tabs-next.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ const basics = () => html`
<cosmoz-tab-next badge="4" active href="#123">Tab4</cosmoz-tab-next>
${Array(6)
.fill()
.map(
(_, i) =>
html`<cosmoz-tab-next badge=${5 + i}>Tab ${5 + i}</cosmoz-tab-next>`
)}
.map((_, i) => html`<cosmoz-tab-next>Tab ${5 + i}</cosmoz-tab-next>`)}
</cosmoz-tabs-next>
`;

Expand Down

0 comments on commit 0c0ce5f

Please sign in to comment.