feat(ui): show icons in the select menu

This commit is contained in:
2026-02-21 22:41:21 +01:00
parent 0a6d9dd2d2
commit 7be6a7c3a2
51 changed files with 34 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { z } from "zod";
import { LazyApiModal } from "#components";
import type { SelectMenuItem } from "@nuxt/ui";
const qrCode = ref("/default.webp");
const form = useTemplateRef("form");
@@ -13,6 +14,19 @@ const isQRCodeEmpty = computed(() => qrCode.value === "/default.webp");
const { data: logos } = await useFetch<string[]>("/api/logos");
const logoItems = computed<SelectMenuItem[]>(() =>
(logos.value ?? []).map((name) => ({
label: capitalize(name),
value: name,
avatar: { src: `/icons/${name}.png`, alt: name },
})),
);
const selectedLogoItem = computed({
get: () => logoItems.value.find((i) => i.value === formState.logo),
set: (item) => { formState.logo = item?.value as string | undefined; },
});
const formSchema = z
.object({
hasLogo: z.boolean(),
@@ -138,20 +152,33 @@ const {
</template>
<USelectMenu
v-model="formState.logo"
icon="i-heroicons-photo"
:items="logos ?? []"
v-model="selectedLogoItem"
:items="logoItems"
:disabled="!formState.hasLogo"
placeholder="Select logo"
class="w-full"
>
<template #item-label="{ item }">
{{ capitalize(item) }}
<template #leading>
<img
v-if="selectedLogoItem"
:src="selectedLogoItem.avatar?.src"
:alt="selectedLogoItem.label"
class="size-4 dark:invert"
/>
<UIcon v-else name="i-heroicons-photo" class="size-4 text-dimmed" />
</template>
<template v-if="formState.logo">{{
capitalize(formState.logo)
<template v-if="selectedLogoItem">{{
selectedLogoItem.label
}}</template>
<template #item-leading="{ item }">
<img
:src="item.avatar?.src"
:alt="item.label"
class="size-4 dark:invert"
/>
</template>
</USelectMenu>
</UFormField>

BIN
public/icons/bereal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

BIN
public/icons/bitcoin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
public/icons/codeberg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

BIN
public/icons/codecademy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

BIN
public/icons/diaspora.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

BIN
public/icons/discord.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 881 B

BIN
public/icons/dropbox.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

BIN
public/icons/ello.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

BIN
public/icons/facebook.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

BIN
public/icons/flickr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

BIN
public/icons/git.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

BIN
public/icons/gitea.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

BIN
public/icons/github.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

BIN
public/icons/gitlab.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

BIN
public/icons/googlemaps.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

BIN
public/icons/googlemeet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

BIN
public/icons/imessage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

BIN
public/icons/instagram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
public/icons/kik.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

BIN
public/icons/line.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

BIN
public/icons/linkedin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

BIN
public/icons/litecoin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

BIN
public/icons/mastodon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

BIN
public/icons/medium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

BIN
public/icons/messenger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

BIN
public/icons/monero.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

BIN
public/icons/napster.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

BIN
public/icons/onlyfans.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

BIN
public/icons/patreon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

BIN
public/icons/paypal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

BIN
public/icons/peertube.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

BIN
public/icons/pinterest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
public/icons/reddit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
public/icons/session.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

BIN
public/icons/signal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

BIN
public/icons/snapchat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

BIN
public/icons/spotify.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

BIN
public/icons/substack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

BIN
public/icons/telegram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

BIN
public/icons/threema.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

BIN
public/icons/twitch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

BIN
public/icons/venmo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

BIN
public/icons/viber.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
public/icons/wechat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

BIN
public/icons/whatsapp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
public/icons/x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 B

BIN
public/icons/youtube.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

BIN
public/icons/zoom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B