/
AppSocialIcons.vue
57 lines (51 loc) · 1.14 KB
/
AppSocialIcons.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<script setup lang="ts">
const socials = ['twitter', 'facebook', 'instagram', 'youtube', 'github', 'medium']
const docus = useDocus()
const icons = computed<any>(() => {
return Object.entries(docus.value.socials || {})
.map(([key, value]) => {
if (typeof value === 'object') {
return value
} else if (typeof value === 'string' && value && socials.includes(key)) {
return {
href: `https://${key}.com/${value}`,
icon: `fa-brands:${key}`,
label: value
}
} else {
return null
}
})
.filter(Boolean)
})
</script>
<template>
<NuxtLink
v-for="icon in icons"
:key="icon.label"
rel="noopener noreferrer"
:title="icon.label"
:aria-label="icon.label"
:href="icon.href"
target="_blank"
>
<Icon v-if="icon.icon" :name="icon.icon" />
</NuxtLink>
</template>
<style lang="ts" scoped>
css({
a: {
display: 'flex',
color: '{color.gray.500}',
'@dark': {
color: '{color.gray.400}'
},
'&:hover': {
color: '{color.gray.700}',
'@dark': {
color: '{color.gray.200}',
}
},
}
})
</style>