5
5
class =" nav-item"
6
6
v-for =" item in userLinks"
7
7
:key =" item.link" >
8
- <div
8
+ <dropdown-link
9
9
v-if =" item.type === 'links'"
10
- class =" dropdown-wrapper" >
11
- <span class =" dropdown-title" >{{ item.text }}</span >
12
- <span class =" arrow" ></span >
13
- <ul class =" nav-dropdown" >
14
- <li
15
- class =" dropdown-item"
16
- v-for =" subItem in item.items"
17
- :key =" subItem.link" >
18
- <h4 v-if =" subItem.type === 'links'" >{{ subItem.text }}</h4 >
19
- <ul class =" dropdown-subitem-wrapper" v-if =" subItem.type === 'links'" >
20
- <li
21
- class =" dropdown-subitem"
22
- v-for =" childSubItem in subItem.items"
23
- :key =" childSubItem.link" >
24
- <nav-link :item =" childSubItem" ></nav-link >
25
- </li >
26
- </ul >
27
- <nav-link v-else :item =" subItem" ></nav-link >
28
- </li >
29
- </ul >
30
- </div >
10
+ :item =" item" ></dropdown-link >
31
11
<nav-link v-else :item =" item" ></nav-link >
32
12
</div >
33
13
<!-- github link -->
46
26
import OutboundLink from ' ./OutboundLink.vue'
47
27
import { isActive , resolveNavLinkItem } from ' ./util'
48
28
import NavLink from ' ./NavLink.vue'
29
+ import DropdownLink from ' ./DropdownLink.vue'
49
30
50
31
export default {
51
- components: { OutboundLink, NavLink },
32
+ components: { OutboundLink, NavLink, DropdownLink },
52
33
computed: {
53
34
userLinks () {
54
35
return (this .$site .themeConfig .nav || []).map ((link => {
@@ -89,59 +70,6 @@ export default {
89
70
margin-left 1.5rem
90
71
font-weight 500
91
72
line-height 2rem
92
- .dropdown-wrapper
93
- & :hover .nav-dropdown
94
- display block
95
- .arrow
96
- display inline-block
97
- vertical-align middle
98
- margin-top - 1px
99
- margin-left 6px
100
- width 0
101
- height 0
102
- border-left 4px solid transparent
103
- border-right 4px solid transparent
104
- border-top 5px solid #c c c
105
- .nav-dropdown
106
- .dropdown-item
107
- color inherit
108
- line-height 1.7rem
109
- h4
110
- margin 0.45rem 0 0
111
- border-top 1px solid #e e e
112
- padding 0.45rem 1.5rem 0 1.25rem
113
- .dropdown-subitem-wrapper
114
- padding 0
115
- list-style none
116
- .dropdown-subitem
117
- font-size 0.9em
118
- a
119
- display block
120
- height 1.7rem
121
- line-height 1.7rem
122
- position relative
123
- border-bottom none
124
- font-weight 400
125
- margin-bottom 0
126
- padding 0 1.5rem 0 1.25rem
127
- & :hover
128
- color $accentColor
129
- & .router-link-active
130
- color $accentColor
131
- & ::after
132
- content ""
133
- width 0
134
- height 0
135
- border-left 5px solid $accentColor
136
- border-top 4px solid transparent
137
- border-bottom 4px solid transparent
138
- position absolute
139
- top calc (50% - 3px )
140
- left 10px
141
- & :first-child h4
142
- margin-top 0
143
- padding-top 0
144
- border-top 0
145
73
.github-link
146
74
margin-left 1.5rem
147
75
@@ -157,20 +85,4 @@ export default {
157
85
color $textColor
158
86
margin-bottom - 2px
159
87
border-bottom 2px solid lighten ($accentColor , 5% )
160
- .nav-dropdown
161
- display none
162
- box-sizing border-box ;
163
- max-height calc (100vh - 2.7rem )
164
- overflow-y auto
165
- position absolute
166
- top 100%
167
- right 0
168
- background-color #f f f
169
- padding 10px 0
170
- border 1px solid #d d d
171
- border-bottom-color #c c c
172
- text-align left
173
- border-radius 0.25rem
174
- white-space nowrap
175
- margin 0
176
88
</style >
0 commit comments