feat: new badge design
This commit is contained in:
1 parent
c936e96f75
commit
7dad1b30b9
2 files changed
+30
-14
No files matched your search
@@ -67,31 +67,36 @@
|
|||||||
|
|
||||||
<div class="flex flex-row ml-auto gap-2 flex-wrap">
|
<div class="flex flex-row ml-auto gap-2 flex-wrap">
|
||||||
{#if nsfw}
|
{#if nsfw}
|
||||||
<Badge class="bg-red-600 text-white">NSFW</Badge>
|
<Badge color="red">NSFW</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
{#if saved}
|
{#if saved}
|
||||||
<Badge class="bg-yellow-500 text-white py-1" label="Saved">
|
<Badge label="Saved" color="yellow">
|
||||||
<Icon src={Bookmark} mini width={16} />
|
<Icon src={Bookmark} mini size="12" />
|
||||||
|
Saved
|
||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
{#if locked}
|
{#if locked}
|
||||||
<Badge class="bg-yellow-400 text-black py-1" label="Locked">
|
<Badge label="Locked" color="yellow">
|
||||||
<Icon src={LockClosed} mini width={16} />
|
<Icon src={LockClosed} mini size="14" />
|
||||||
|
Locked
|
||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
{#if removed}
|
{#if removed}
|
||||||
<Badge class="bg-green-600 text-white py-1" label="Removed">
|
<Badge label="Removed" color="red">
|
||||||
<Icon src={Trash} mini width={16} />
|
<Icon src={Trash} mini size="14" />
|
||||||
|
Removed
|
||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
{#if deleted}
|
{#if deleted}
|
||||||
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
<Badge label="Deleted" color="red">
|
||||||
<Icon src={Trash} mini width={16} />
|
<Icon src={Trash} mini size="14" />
|
||||||
|
Deleted
|
||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
{#if featured}
|
{#if featured}
|
||||||
<Badge class="bg-green-500 text-white py-1" label="Pinned">
|
<Badge label="Pinned" color="green">
|
||||||
<Icon src={InformationCircle} mini width={16} />
|
<Icon src={InformationCircle} mini size="14" />
|
||||||
|
Pinned
|
||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,12 +1,23 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let label: string = ''
|
export let label: string = ''
|
||||||
|
|
||||||
let clazz = ''
|
const badgeColor = {
|
||||||
export { clazz as class }
|
red: 'bg-red-200 dark:bg-red-900 text-red-800 dark:text-red-300',
|
||||||
|
green: 'bg-green-200 dark:bg-green-900 text-green-800 dark:text-green-300',
|
||||||
|
yellow:
|
||||||
|
'bg-yellow-200 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-300',
|
||||||
|
gray: 'bg-slate-200 dark:bg-zinc-800 text-gray-800 dark:text-gray-200',
|
||||||
|
}
|
||||||
|
|
||||||
|
type BadgeColor = keyof typeof badgeColor
|
||||||
|
|
||||||
|
export let color: BadgeColor = 'gray'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="px-1 py-0.5 rounded-md text-xs ml-auto font-bold {clazz}"
|
class="px-2 py-0.5 rounded-full text-xs ml-auto font-bold flex items-center gap-1 {badgeColor[
|
||||||
|
color
|
||||||
|
]} {$$props.class}"
|
||||||
title={label}
|
title={label}
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
|
|||||||
Reference in new issue
Block a user