Skip to content

Commit a8fe727

Browse files
Refactor social media icon handling in components
1 parent 226e4a5 commit a8fe727

File tree

7 files changed

+4978
-5997
lines changed

7 files changed

+4978
-5997
lines changed

components/Nav/Footer.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import type { Query } from '@directus/sdk';
33
import type { Navigation, Schema } from '~/types/schema';
4-
import { dynamicAsset } from '~/utils/dynamicAsset';
4+
import { getSocialIcon } from '~/utils/social';
55
66
const { $directus, $readItem, $readSingleton } = useNuxtApp();
77
@@ -89,7 +89,7 @@ const socials = {
8989
<ul class="socials">
9090
<li v-for="[service, link] in Object.entries(socials)" :key="service">
9191
<NuxtLink :href="link">
92-
<img :src="dynamicAsset(`/svg/social/${service}.svg`)" :alt="service" loading="lazy" />
92+
<Icon :name="getSocialIcon(service)" class="icon" />
9393
</NuxtLink>
9494
</li>
9595
</ul>
@@ -261,14 +261,15 @@ const socials = {
261261
align-items: center;
262262
justify-content: space-between;
263263
264-
img {
265-
width: var(--space-5);
266-
height: auto;
264+
.icon {
265+
width: var(--space-6);
266+
height: var(--space-6);
267267
filter: brightness(1);
268268
transition: filter var(--duration-150) var(--ease-out);
269269
270270
@media (width > 35rem) {
271-
width: var(--space-6);
271+
width: var(--space-8);
272+
height: var(--space-8);
272273
}
273274
274275
&:hover {

components/Tv/TVByline.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { dynamicAsset } from '~/utils/dynamicAsset';
2+
import { getSocialIcon } from '~/utils/social';
33
44
interface BaseBylineProps {
55
name?: string;
@@ -34,7 +34,7 @@ defineProps<BaseBylineProps>();
3434
<div v-if="links" class="share-icons">
3535
<template v-for="{ service, url } in links" :key="service">
3636
<NuxtLink :href="url" target="_blank">
37-
<img :src="dynamicAsset(`/svg/social/${service}.svg`)" :alt="service" />
37+
<Icon :name="getSocialIcon(service)" class="icon" />
3838
</NuxtLink>
3939
</template>
4040
</div>
@@ -83,10 +83,10 @@ defineProps<BaseBylineProps>();
8383
align-items: center;
8484
gap: var(--space-5);
8585
86-
img {
86+
.icon {
8787
margin-block-start: var(--space-1);
8888
width: var(--space-6);
89-
height: auto;
89+
height: var(--space-6);
9090
filter: brightness(1);
9191
transition: filter var(--duration-150) var(--ease-out);
9292

pages/creators/[slug].vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import type { Creator } from '~/types/schema';
3-
import { dynamicAsset } from '~/utils/dynamicAsset';
43
import { userName } from '~/utils/userName';
4+
import { getSocialIcon } from '~/utils/social';
55
66
const { params } = useRoute();
77
@@ -118,7 +118,7 @@ definePageMeta({
118118
<div class="share-icons">
119119
<template v-for="{ services, url } in creator?.links" :key="services">
120120
<NuxtLink :href="url" target="_blank">
121-
<img :src="dynamicAsset(`/svg/social/${services}.svg`)" :alt="services" />
121+
<Icon :name="getSocialIcon(services)" class="icon" />
122122
</NuxtLink>
123123
</template>
124124
</div>
@@ -226,9 +226,9 @@ definePageMeta({
226226
227227
margin-block-start: var(--space-4);
228228
229-
img {
229+
.icon {
230230
width: var(--space-7);
231-
height: auto;
231+
height: var(--space-7);
232232
filter: brightness(1);
233233
transition: filter var(--duration-150) var(--ease-out);
234234

pages/team/[slug].vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { dynamicAsset } from '~/utils/dynamicAsset';
2+
import { getSocialIcon } from '~/utils/social';
33
44
const { params } = useRoute();
55
@@ -147,7 +147,7 @@ definePageMeta({
147147
<div class="share-icons">
148148
<template v-for="{ services, url } in person?.links" :key="services">
149149
<NuxtLink :href="url" target="_blank">
150-
<img :src="dynamicAsset(`/svg/social/${services}.svg`)" :alt="services" />
150+
<Icon :name="getSocialIcon(services)" class="icon" />
151151
</NuxtLink>
152152
</template>
153153
</div>
@@ -265,9 +265,9 @@ definePageMeta({
265265
align-items: center;
266266
gap: var(--space-5);
267267
268-
img {
268+
.icon {
269269
width: var(--space-7);
270-
height: auto;
270+
height: var(--space-7);
271271
filter: brightness(1);
272272
transition: filter var(--duration-150) var(--ease-out);
273273

0 commit comments

Comments
 (0)