Skip to content

Commit 52c1f1c

Browse files
committed
refactor: ⚡ Ditch nuxt-icon in favour of iconify's native WebComponent
1 parent e622c16 commit 52c1f1c

20 files changed

+146
-136
lines changed

app.vue

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
<script setup lang="ts">
1010
import { convert } from "html-to-text";
11+
import "iconify-icon";
1112
// Use SSR-safe IDs for Headless UI
1213
provideHeadlessUseId(() => useId());
1314

bun.lockb

368 Bytes
Binary file not shown.

components/buttons/DropdownElement.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<ButtonsBase
33
class="bg-white/10 hover:bg-white/20 !text-left flex flex-row gap-x-3 !rounded-none !ring-0 !p-4 sm:!p-3">
4-
<Icon :name="icon" class="h-5 w-5 text-gray-200" aria-hidden="true" />
4+
<iconify-icon :icon="icon" width="1.25rem" height="1.25rem" class="text-gray-200" aria-hidden="true" />
55
<slot />
66
</ButtonsBase>
77
</template>
88

99
<script lang="ts" setup>
1010
import type { ButtonHTMLAttributes } from "vue";
1111
12-
interface Props extends /* @vue-ignore */ ButtonHTMLAttributes {}
12+
interface Props extends /* @vue-ignore */ ButtonHTMLAttributes { }
1313
1414
defineProps<
1515
Props & {

components/buttons/base.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<button v-bind="$props" type="button" :disabled="loading"
33
:class="['rounded-md duration-200 relative hover:shadow disabled:opacity-70 content-none disabled:cursor-not-allowed px-3 py-2 text-sm font-semibold text-white shadow-sm', loading && '[&>*]:invisible']">
44
<div v-if="loading" class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 !visible">
5-
<Icon name="tabler:loader-2" class="animate-spin w-5 h-5" />
5+
<iconify-icon icon="tabler:loader-2" height="1.25rem" width="1.25rem" class="animate-spin" />
66
</div>
77
<slot />
88
</button>
@@ -11,7 +11,7 @@
1111
<script lang="ts" setup>
1212
import type { ButtonHTMLAttributes } from "vue";
1313
14-
interface Props extends /* @vue-ignore */ ButtonHTMLAttributes {}
14+
interface Props extends /* @vue-ignore */ ButtonHTMLAttributes { }
1515
1616
defineProps<
1717
Props & {

components/composer/composer.vue

+11-8
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
<div class="py-2 relative">
44
<div v-if="respondingTo" class="mb-4">
55
<span v-if="respondingType === 'reply'" class="text-gray-400 uppercase text-xs font-semibold">
6-
<Icon name="tabler:arrow-back-up" class="h-4 w-4 text-gray-400 mb-0.5" aria-hidden="true" />
6+
<iconify-icon width="1rem" height="1rem" icon="tabler:arrow-back-up" class="text-gray-400 mb-0.5"
7+
aria-hidden="true" />
78
Replying to
89
</span>
910
<span v-else-if="respondingType === 'quote'" class="text-gray-400 uppercase text-xs font-semibold">
10-
<Icon name="tabler:quote" class="h-4 w-4 text-gray-400" aria-hidden="true" />
11+
<iconify-icon width="1rem" height="1rem" icon="tabler:quote" class="text-gray-400"
12+
aria-hidden="true" />
1113
Quoting
1214
</span>
1315
<OverlayScrollbarsComponent :defer="true" class="mt-2 max-h-72 overflow-y-auto">
@@ -28,22 +30,23 @@
2830
</div>
2931
<div class="flex flex-row gap-1 border-white/20">
3032
<ComposerButton title="Mention someone">
31-
<Icon name="tabler:at" class="size-6" aria-hidden="true" />
33+
<iconify-icon height="1.5rem" width="1.5rem" icon="tabler:at" aria-hidden="true" />
3234
</ComposerButton>
3335
<ComposerButton title="Toggle Markdown" @click="markdown = !markdown" :toggled="markdown">
34-
<Icon :name="markdown ? 'tabler:markdown' : 'tabler:markdown-off'" class="size-6" aria-hidden="true" />
36+
<iconify-icon width="1.25rem" height="1.25rem"
37+
:icon="markdown ? 'tabler:markdown' : 'tabler:markdown-off'" aria-hidden="true" />
3538
</ComposerButton>
3639
<ComposerButton title="Use a custom emoji">
37-
<Icon name="tabler:mood-smile" class="size-6" aria-hidden="true" />
40+
<iconify-icon width="1.25rem" height="1.25rem" icon="tabler:mood-smile" aria-hidden="true" />
3841
</ComposerButton>
3942
<ComposerButton title="Add media">
40-
<Icon name="tabler:photo-up" class="size-6" aria-hidden="true" />
43+
<iconify-icon width="1.25rem" height="1.25rem" icon="tabler:photo-up" aria-hidden="true" />
4144
</ComposerButton>
4245
<ComposerButton title="Add a file">
43-
<Icon name="tabler:file-upload" class="size-6" aria-hidden="true" />
46+
<iconify-icon width="1.25rem" height="1.25rem" icon="tabler:file-upload" aria-hidden="true" />
4447
</ComposerButton>
4548
<ComposerButton title="Add content warning" @click="cw = cw === null ? '' : null" :toggled="cw !== null">
46-
<Icon name="tabler:rating-18-plus" class="size-6" aria-hidden="true" />
49+
<iconify-icon width="1.25rem" height="1.25rem" icon="tabler:rating-18-plus" aria-hidden="true" />
4750
</ComposerButton>
4851
<ButtonsPrimary :loading="submitting" @click="send" class="ml-auto rounded-full">
4952
<span>Send!</span>

components/headers/navbar.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class="-m-2.5 inline-flex items-center justify-center rounded-md p-2.5 text-gray-200"
2424
@click="mobileMenuOpen = true">
2525
<span class="sr-only">Open main menu</span>
26-
<Icon name="tabler:menu-2" class="h-6 w-6" aria-hidden="true" />
26+
<iconify-icon icon="tabler:menu-2" width="1.5rem" height="1.5rem" aria-hidden="true" />
2727
</button>
2828
</div>
2929
<div class="hidden lg:flex lg:gap-x-12">
@@ -45,7 +45,7 @@
4545
</NuxtLink>
4646
<button type="button" class="-m-2.5 rounded-md p-2.5 text-gray-200" @click="mobileMenuOpen = false">
4747
<span class="sr-only">Close menu</span>
48-
<Icon name="tabler:x" class="h-6 w-6" aria-hidden="true" />
48+
<iconify-icon icon="tabler:x" width="1.5rem" height="1.5rem" aria-hidden="true" />
4949
</button>
5050
</div>
5151
<div class="mt-6 flow-root">

components/sidebars/collapsible-aside.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</OverlayScrollbarsComponent>
88
<button @click="open = !open"
99
class="h-full bg-dark-700 hover:bg-dark-400 hover:cursor-pointer duration-200 py-4 px-0.5 flex items-center justify-center w-4 shrink-0">
10-
<Icon name="tabler:chevron-right"
10+
<iconify-icon icon="tabler:chevron-right"
1111
:class="['text-gray-200 duration-200', direction === 'left' ? open ? 'rotate-180' : 'rotate-0' : open ? 'rotate-0' : 'rotate-180']"
1212
aria-hidden="true" />
1313
</button>

components/sidebars/navigation.vue

+15-13
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<NuxtLink v-for="timeline in visibleTimelines" :key="timeline.href" :to="timeline.href">
1414
<ButtonsBase
1515
class="flex flex-row text-left items-center justify-start gap-3 text-lg hover:ring-1 ring-white/10 overflow-hidden h-12 w-full duration-200">
16-
<Icon :name="timeline.icon" class="shrink-0 text-2xl" />
16+
<iconify-icon :icon="timeline.icon" class="shrink-0 text-2xl" />
1717
<span class="pr-28 line-clamp-1">{{ timeline.name }}</span>
1818
</ButtonsBase>
1919
</NuxtLink>
@@ -27,18 +27,18 @@
2727
<ButtonsBase v-if="tokenData" @click="signOut().finally(() => loadingAuth = false)"
2828
:loading="loadingAuth"
2929
class="flex flex-row text-left items-center justify-start gap-3 text-lg hover:ring-1 ring-white/10 overflow-hidden h-12 w-full duration-200">
30-
<Icon name="tabler:logout" class="shrink-0 text-2xl" />
30+
<iconify-icon icon="tabler:logout" class="shrink-0 text-2xl" />
3131
<span class="pr-28 line-clamp-1">Sign Out</span>
3232
</ButtonsBase>
3333
<ButtonsBase v-else @click="signIn().finally(() => loadingAuth = false)" :loading="loadingAuth"
3434
class="flex flex-row text-left items-center justify-start gap-3 text-lg hover:ring-1 ring-white/10 overflow-hidden h-12 w-full duration-200">
35-
<Icon name="tabler:login" class="shrink-0 text-2xl" />
35+
<iconify-icon icon="tabler:login" class="shrink-0 text-2xl" />
3636
<span class="pr-28 line-clamp-1">Sign In</span>
3737
</ButtonsBase>
3838
<NuxtLink href="/register" v-if="!tokenData">
3939
<ButtonsBase
4040
class="flex flex-row text-left items-center justify-start gap-3 text-lg hover:ring-1 ring-white/10 overflow-hidden h-12 w-full duration-200">
41-
<Icon name="tabler:certificate" class="shrink-0 text-2xl" />
41+
<iconify-icon icon="tabler:certificate" class="shrink-0 text-2xl" />
4242
<span class="pr-28 line-clamp-1">Register</span>
4343
</ButtonsBase>
4444
</NuxtLink>
@@ -47,16 +47,18 @@
4747
Posts</h3>
4848
<ButtonsBase v-if="tokenData" @click="compose" title="Open composer (shortcut: n)"
4949
class="flex flex-row text-left items-center justify-start gap-3 text-lg hover:ring-1 ring-white/10 bg-gradient-to-tr from-pink-300 via-purple-300 to-indigo-400 overflow-hidden h-12 w-full duration-200">
50-
<Icon name="tabler:writing" class="shrink-0 text-2xl" />
50+
<iconify-icon icon="tabler:writing" class="shrink-0 text-2xl" />
5151
<span class="pr-28 line-clamp-1">Compose</span>
5252
<kbd class="text-xs font-semibold rounded bg-dark-500 font-mono px-1 flex flex-row">
53-
<Icon name="tabler:keyboard" class="size-4 inline" aria-hidden="true" />
54-
<Icon name="tabler:letter-n-small" class="size-4 inline -mr-1" aria-hidden="true" />
53+
<iconify-icon icon="tabler:keyboard" height="1rem" width="1rem" class="inline"
54+
aria-hidden="true" />
55+
<iconify-icon icon="tabler:letter-n-small" height="1rem" width="1rem" class="inline -mr-1"
56+
aria-hidden="true" />
5557
</kbd>
5658
</ButtonsBase>
5759
<ButtonsBase v-if="$pwa?.needRefresh" @click="$pwa?.updateServiceWorker()" title="Update service worker"
5860
class="flex flex-row text-left items-center justify-start gap-3 text-lg ring-2 ring-pink-600 overflow-hidden h-12 w-full duration-200">
59-
<Icon name="tabler:refresh" class="shrink-0 text-2xl" />
61+
<iconify-icon icon="tabler:refresh" class="shrink-0 text-2xl" />
6062
<span class="pr-28 line-clamp-1">Update</span>
6163
</ButtonsBase>
6264
</ClientOnly>
@@ -69,7 +71,7 @@
6971
<DropdownsAdaptiveDropdown>
7072
<template #button>
7173
<HeadlessMenuButton class="flex flex-col items-center justify-center p-2 rounded">
72-
<Icon name="tabler:home" class="text-2xl" />
74+
<iconify-icon icon="tabler:home" class="text-2xl" />
7375
<span class="text-xs">Timelines</span>
7476
</HeadlessMenuButton>
7577
</template>
@@ -88,20 +90,20 @@
8890
</template>
8991
</DropdownsAdaptiveDropdown>
9092
<NuxtLink href="/notifications" class="flex flex-col items-center justify-center p-2 rounded">
91-
<Icon name="tabler:bell" class="text-2xl" />
93+
<iconify-icon icon="tabler:bell" class="text-2xl" />
9294
<span class="text-xs">Notifications</span>
9395
</NuxtLink>
9496
<ClientOnly v-if="$pwa?.needRefresh">
9597
<button class="flex flex-col items-center justify-center p-2 rounded ring-2 ring-pink-600"
9698
@click="$pwa?.updateServiceWorker(true)">
97-
<Icon name="tabler:refresh" class="text-2xl" />
99+
<iconify-icon icon="tabler:refresh" class="text-2xl" />
98100
<span class="text-xs">Update</span>
99101
</button>
100102
</ClientOnly>
101103
<DropdownsAdaptiveDropdown v-else>
102104
<template #button>
103105
<HeadlessMenuButton class="flex flex-col items-center justify-center p-2 rounded">
104-
<Icon name="tabler:user" class="text-2xl" />
106+
<iconify-icon icon="tabler:user" class="text-2xl" />
105107
<span class="text-xs">Account</span>
106108
</HeadlessMenuButton>
107109
</template>
@@ -132,7 +134,7 @@
132134
</DropdownsAdaptiveDropdown>
133135
<button @click="compose" v-if="tokenData"
134136
class="flex flex-col items-center justify-center p-2 rounded bg-gradient-to-tr from-pink-300/70 via-purple-300/70 to-indigo-400/70">
135-
<Icon name="tabler:writing" class="text-2xl" />
137+
<iconify-icon icon="tabler:writing" class="text-2xl" />
136138
<span class="text-xs">Compose</span>
137139
</button>
138140
</ClientOnly>

components/social-elements/notes/attachment.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
@click="lightbox = false">
2222
<div class="w-full absolute inset-x-0 top-0 p-10 shrink text-gray-400 flex flex-row gap-3">
2323
<a @click.stop :href="attachment.url" target="_blank" download class="ml-auto">
24-
<Icon name="tabler:download" class="w-6 h-6" />
24+
<iconify-icon icon="tabler:download" width="1.5rem" height="1.5rem" />
2525
<span class="sr-only">Close</span>
2626
</a>
27-
<button @click.stop="lightbox = false" class="">
28-
<Icon name="tabler:x" class="w-6 h-6" />
27+
<button @click.stop="lightbox = false">
28+
<iconify-icon icon="tabler:x" width="1.5rem" height="1.5rem" />
2929
<span class="sr-only">Close</span>
3030
</button>
3131
</div>

components/social-elements/notes/header.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@
4848
}}</span>
4949
<span @click="copyAccount" v-if="!hasCopied"
5050
class="hidden select-none group-hover:flex cursor-pointer items-center gap-x-1">
51-
<Icon name="tabler:clipboard" class="h-4 w-4 text-gray-200" aria-hidden="true" />
51+
<iconify-icon icon="tabler:clipboard" height="1rem" width="1rem" class="text-gray-200"
52+
aria-hidden="true" />
5253
Click to copy
5354
</span>
5455
<span v-else class="hidden group-hover:flex select-none items-center gap-x-1">
55-
<Icon name="tabler:check" class="h-4 w-4 text-green-500" aria-hidden="true" />
56+
<iconify-icon icon="tabler:check" height="1rem" width="1rem" class="text-green-500"
57+
aria-hidden="true" />
5658
Copied!
5759
</span>
5860
</Skeleton>

components/social-elements/notes/note-content.vue

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
<template>
2-
<div v-if="!collapsed">
3-
<div class="mt-6 block relative">
4-
<Skeleton :enabled="!props.note || !loaded" :min-width="50" :max-width="100" width-unit="%" shape="rect"
5-
type="content">
6-
<div v-if="content"
7-
:class="['prose prose-invert duration-200 !max-w-full break-words prose-a:no-underline', $style.content]"
8-
v-html="content">
9-
</div>
10-
</Skeleton>
11-
</div>
2+
<div v-if="!collapsed" class="mt-6">
3+
<Skeleton :enabled="!props.note || !loaded" :min-width="50" :max-width="100" width-unit="%" shape="rect"
4+
type="content">
5+
<div v-if="content"
6+
:class="['prose block relative prose-invert duration-200 !max-w-full break-words prose-a:no-underline', $style.content]"
7+
v-html="content">
8+
</div>
9+
</Skeleton>
1210
<div v-if="note && note.media_attachments.length > 0" class="[&:not(:first-child)]:mt-6">
1311
<SocialElementsNotesAttachment v-for="attachment of note.media_attachments" :key="attachment.id"
1412
:attachment="attachment" />
1513
</div>
16-
<div v-if="isQuote && note?.reblog" class="mt-4">
17-
<LazySocialElementsNotesNote :note="note?.reblog" :small="true" />
18-
</div>
14+
<LazySocialElementsNotesNote v-if="isQuote && note?.reblog" :note="note?.reblog" :small="true"
15+
class="mt-4 !rounded" />
1916
</div>
2017
<div v-else
2118
class="rounded text-center ring-1 !max-w-full ring-white/10 h-52 mt-6 prose prose-invert p-4 flex flex-col justify-center items-center">

0 commit comments

Comments
 (0)