design: add icon

This commit is contained in:
Xylight committed 2024-07-05 12:10:06 -07:00
1 parent 005a8c0e07
commit 3955316195
1 file changed
+10 -6
+10 -6
View File
@@ -23,6 +23,7 @@
import { import {
ArrowLeftOnRectangle, ArrowLeftOnRectangle,
ArrowRightOnRectangle, ArrowRightOnRectangle,
ArrowsRightLeft,
ArrowUturnLeft, ArrowUturnLeft,
BugAnt, BugAnt,
Check, Check,
@@ -184,21 +185,24 @@
? 'Switch' ? 'Switch'
: 'Current'} : 'Current'}
on:click={async () => { on:click={async () => {
if (profile.id == $currentProfile?.id) setUserID(-1) if (profile.id != $currentProfile?.id) {
else {
switching = profile.id switching = profile.id
await setUserID(profile.id) await setUserID(profile.id)
switching = -69 switching = -69
} }
}} }}
size="square-md" size="square-md"
color={profile.id == $currentProfile?.id ? 'primary' : 'secondary'} color={profile.id == $currentProfile?.id ? 'primary' : 'ghost'}
loading={switching == profile.id} loading={switching == profile.id}
disabled={switching == profile.id} disabled={switching == profile.id}
> >
{#if profile.id == $currentProfile?.id} <svelte:fragment slot="prefix">
<Icon src={Check} mini size="16" /> {#if profile.id == $currentProfile?.id}
{/if} <Icon src={Check} mini size="16" />
{:else}
<Icon src={ArrowsRightLeft} size="16" mini />
{/if}
</svelte:fragment>
</Button> </Button>
<Menu placement="bottom-end"> <Menu placement="bottom-end">
<Button size="square-md" slot="target"> <Button size="square-md" slot="target">