feat(ui): show icons in the select menu
@@ -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
|
After Width: | Height: | Size: 705 B |
BIN
public/icons/bitcoin.png
Normal file
|
After Width: | Height: | Size: 984 B |
BIN
public/icons/buymeacoffee.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
public/icons/codeberg.png
Normal file
|
After Width: | Height: | Size: 868 B |
BIN
public/icons/codecademy.png
Normal file
|
After Width: | Height: | Size: 660 B |
BIN
public/icons/diaspora.png
Normal file
|
After Width: | Height: | Size: 846 B |
BIN
public/icons/discord.png
Normal file
|
After Width: | Height: | Size: 881 B |
BIN
public/icons/dropbox.png
Normal file
|
After Width: | Height: | Size: 779 B |
BIN
public/icons/ello.png
Normal file
|
After Width: | Height: | Size: 785 B |
BIN
public/icons/facebook.png
Normal file
|
After Width: | Height: | Size: 916 B |
BIN
public/icons/flickr.png
Normal file
|
After Width: | Height: | Size: 593 B |
BIN
public/icons/git.png
Normal file
|
After Width: | Height: | Size: 719 B |
BIN
public/icons/gitea.png
Normal file
|
After Width: | Height: | Size: 829 B |
BIN
public/icons/github.png
Normal file
|
After Width: | Height: | Size: 999 B |
BIN
public/icons/gitlab.png
Normal file
|
After Width: | Height: | Size: 723 B |
BIN
public/icons/googlemaps.png
Normal file
|
After Width: | Height: | Size: 957 B |
BIN
public/icons/googlemeet.png
Normal file
|
After Width: | Height: | Size: 856 B |
BIN
public/icons/googlemessages.png
Normal file
|
After Width: | Height: | Size: 862 B |
BIN
public/icons/imessage.png
Normal file
|
After Width: | Height: | Size: 761 B |
BIN
public/icons/instagram.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/icons/kik.png
Normal file
|
After Width: | Height: | Size: 809 B |
BIN
public/icons/line.png
Normal file
|
After Width: | Height: | Size: 962 B |
BIN
public/icons/linkedin.png
Normal file
|
After Width: | Height: | Size: 741 B |
BIN
public/icons/litecoin.png
Normal file
|
After Width: | Height: | Size: 902 B |
BIN
public/icons/mastodon.png
Normal file
|
After Width: | Height: | Size: 1000 B |
BIN
public/icons/medium.png
Normal file
|
After Width: | Height: | Size: 710 B |
BIN
public/icons/messenger.png
Normal file
|
After Width: | Height: | Size: 888 B |
BIN
public/icons/monero.png
Normal file
|
After Width: | Height: | Size: 916 B |
BIN
public/icons/napster.png
Normal file
|
After Width: | Height: | Size: 959 B |
BIN
public/icons/onlyfans.png
Normal file
|
After Width: | Height: | Size: 742 B |
BIN
public/icons/patreon.png
Normal file
|
After Width: | Height: | Size: 740 B |
BIN
public/icons/paypal.png
Normal file
|
After Width: | Height: | Size: 864 B |
BIN
public/icons/peertube.png
Normal file
|
After Width: | Height: | Size: 629 B |
BIN
public/icons/pinterest.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/icons/reddit.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
public/icons/session.png
Normal file
|
After Width: | Height: | Size: 1016 B |
BIN
public/icons/signal.png
Normal file
|
After Width: | Height: | Size: 1012 B |
BIN
public/icons/snapchat.png
Normal file
|
After Width: | Height: | Size: 762 B |
BIN
public/icons/spotify.png
Normal file
|
After Width: | Height: | Size: 975 B |
BIN
public/icons/substack.png
Normal file
|
After Width: | Height: | Size: 638 B |
BIN
public/icons/telegram.png
Normal file
|
After Width: | Height: | Size: 857 B |
BIN
public/icons/threema.png
Normal file
|
After Width: | Height: | Size: 960 B |
BIN
public/icons/twitch.png
Normal file
|
After Width: | Height: | Size: 775 B |
BIN
public/icons/venmo.png
Normal file
|
After Width: | Height: | Size: 718 B |
BIN
public/icons/viber.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
public/icons/wechat.png
Normal file
|
After Width: | Height: | Size: 918 B |
BIN
public/icons/whatsapp.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/icons/x.png
Normal file
|
After Width: | Height: | Size: 1013 B |
BIN
public/icons/youtube.png
Normal file
|
After Width: | Height: | Size: 666 B |
BIN
public/icons/zoom.png
Normal file
|
After Width: | Height: | Size: 689 B |