-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavDropdownLinkItem.vue
76 lines (66 loc) · 1.59 KB
/
NavDropdownLinkItem.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<template>
<div class="nav-dropdown-link-item">
<a class="item" v-bind="linkProps">
<!-- <span class="arrow" /> -->
<span class="text md:ml-2">{{ item.text }}</span>
<span class="icon"><OutboundLink v-if="isExternal" class="ml-0.5 opacity-50 align-middle"/></span>
</a>
</div>
</template>
<script setup lang="ts">
import { toRefs } from 'vue'
import type { DefaultTheme } from '../config'
import { useNavLink } from '../composables/navLink'
import OutboundLink from './icons/OutboundLink.vue'
const props = defineProps<{
item: DefaultTheme.NavItemWithLink
}>()
const propsRefs = toRefs(props)
const { props: linkProps, isExternal } = useNavLink(propsRefs.item)
</script>
<style scoped>
.item {
display: block;
padding: 0 1.5rem 0 2.5rem;
line-height: 32px;
font-size: 0.9rem;
font-weight: 500;
color: var(--c-text);
white-space: nowrap;
}
@media (min-width: 720px) {
.item {
padding: 0 24px 0 12px;
line-height: 32px;
font-size: 0.85rem;
font-weight: 500;
color: var(--c-text);
white-space: nowrap;
}
.item.active .arrow {
opacity: 1;
}
}
.item:hover,
.item.active {
text-decoration: none;
color: var(--c-brand);
}
.item.external:hover {
border-bottom-color: transparent;
color: var(--c-text);
}
@media (min-width: 720px) {
.arrow {
display: inline-block;
margin-right: 8px;
border-top: 6px solid #ccc;
border-right: 4px solid transparent;
border-bottom: 0;
border-left: 4px solid transparent;
vertical-align: middle;
opacity: 0;
transform: translateY(-2px) rotate(-90deg);
}
}
</style>