/
AppSocialIcons.vue
62 lines (56 loc) · 1.21 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
58
59
60
61
62
<script setup lang="ts">
const socials = ['twitter', 'facebook', 'instagram', 'youtube', 'github', 'medium']
const { config } = useDocus()
const icons = computed<any>(() => {
return Object.entries(config.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,
rel: 'noopener noreferrer'
}
} else {
return null
}
})
.filter(Boolean)
})
</script>
<template>
<NuxtLink
v-for="icon in icons"
:key="icon.label"
:rel="icon.rel"
: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}',
padding: '{space.4}',
'@dark': {
color: '{color.gray.400}'
},
'&:hover': {
color: '{color.gray.700}',
'@dark': {
color: '{color.gray.200}',
}
},
}
})
</style>