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">
|
||||
{#if nsfw}
|
||||
<Badge class="bg-red-600 text-white">NSFW</Badge>
|
||||
<Badge color="red">NSFW</Badge>
|
||||
{/if}
|
||||
{#if saved}
|
||||
<Badge class="bg-yellow-500 text-white py-1" label="Saved">
|
||||
<Icon src={Bookmark} mini width={16} />
|
||||
<Badge label="Saved" color="yellow">
|
||||
<Icon src={Bookmark} mini size="12" />
|
||||
Saved
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if locked}
|
||||
<Badge class="bg-yellow-400 text-black py-1" label="Locked">
|
||||
<Icon src={LockClosed} mini width={16} />
|
||||
<Badge label="Locked" color="yellow">
|
||||
<Icon src={LockClosed} mini size="14" />
|
||||
Locked
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if removed}
|
||||
<Badge class="bg-green-600 text-white py-1" label="Removed">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
<Badge label="Removed" color="red">
|
||||
<Icon src={Trash} mini size="14" />
|
||||
Removed
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if deleted}
|
||||
<Badge class="bg-red-600 text-white py-1" label="Deleted">
|
||||
<Icon src={Trash} mini width={16} />
|
||||
<Badge label="Deleted" color="red">
|
||||
<Icon src={Trash} mini size="14" />
|
||||
Deleted
|
||||
</Badge>
|
||||
{/if}
|
||||
{#if featured}
|
||||
<Badge class="bg-green-500 text-white py-1" label="Pinned">
|
||||
<Icon src={InformationCircle} mini width={16} />
|
||||
<Badge label="Pinned" color="green">
|
||||
<Icon src={InformationCircle} mini size="14" />
|
||||
Pinned
|
||||
</Badge>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
<script lang="ts">
|
||||
export let label: string = ''
|
||||
|
||||
let clazz = ''
|
||||
export { clazz as class }
|
||||
const badgeColor = {
|
||||
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>
|
||||
|
||||
<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}
|
||||
>
|
||||
<slot />
|
||||
|
||||
Reference in new issue
Block a user