Skip to content

Commit

Permalink
fix(ui): ability to remove icon from badge
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Shatford <[email protected]>
  • Loading branch information
jordanshatford committed Mar 14, 2024
1 parent de56ac9 commit 9010e11
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-cherries-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@yd/ui": patch
---

fix: ability to remove icon from badge
10 changes: 5 additions & 5 deletions apps/extension/src/lib/components/PopupMain.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
</Card>
<Card>
<div class="flex max-w-full flex-wrap justify-center gap-2 p-2">
<Badge variant="success">{options.format.toUpperCase()}</Badge>
<Badge variant="success">{options.quality.toUpperCase()}</Badge>
<Badge variant={options.embed_metadata ? 'success' : 'error'}>Metadata</Badge>
<Badge variant={options.embed_thumbnail ? 'success' : 'error'}>Thumbnail</Badge>
<Badge variant={options.embed_subtitles ? 'success' : 'error'}>Subtitles</Badge>
<Badge icon={false} variant="success">{options.format.toUpperCase()}</Badge>
<Badge icon={false} variant="success">{options.quality.toUpperCase()}</Badge>
<Badge icon={false} variant={options.embed_metadata ? 'success' : 'error'}>Metadata</Badge>
<Badge icon={false} variant={options.embed_thumbnail ? 'success' : 'error'}>Thumbnail</Badge>
<Badge icon={false} variant={options.embed_subtitles ? 'success' : 'error'}>Subtitles</Badge>
</div>
</Card>
{#if $store.currentDownload}
Expand Down
8 changes: 7 additions & 1 deletion packages/ui/src/lib/components/Badge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@
export let icon: boolean | IconSource = false;
export let loading: boolean = false;
const _icon = typeof icon === 'object' ? icon : toIcon(variant, { loading });
let _icon: IconSource | undefined = undefined;
// User specified icon
if (typeof icon === 'object') {
_icon = icon;
} else if (icon) {
_icon = toIcon(variant, { loading });
}
const { spanClass, iconWrapperClass, iconClass, textClass, buttonClass } = badgeClasses({
variant,
Expand Down

0 comments on commit 9010e11

Please sign in to comment.