File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 10
10
@keyup.down =" onDown" >
11
11
<ul class =" suggestions"
12
12
v-if =" showSuggestions"
13
+ :class =" { 'align-right': alignRight }"
13
14
@mouseleave =" unfocus" >
14
15
<li class =" suggestion" v-for =" (s, i) in suggestions"
15
16
:class =" { focused: i === focusIndex }"
@@ -73,6 +74,12 @@ export default {
73
74
}
74
75
}
75
76
return res
77
+ },
78
+ // make suggestions align right when there are not enough items
79
+ alignRight () {
80
+ const navCount = (this .$site .themeConfig .nav || []).length
81
+ const repo = this .$site .repo ? 1 : 0
82
+ return navCount + repo <= 2
76
83
}
77
84
},
78
85
methods: {
@@ -145,6 +152,8 @@ export default {
145
152
border-radius 6px
146
153
padding 0.4rem
147
154
list-style-type none
155
+ & .align-right
156
+ right 0
148
157
.suggestion
149
158
line-height 1.4
150
159
padding 0.4rem 0.6rem
@@ -168,12 +177,16 @@ export default {
168
177
position relative
169
178
left 1rem
170
179
& :focus
171
- left 0.5 rem
180
+ left 0
172
181
width 10rem
173
182
174
183
@media (max-width : $MQMobile)
175
184
.search-box
176
185
margin-right 0
177
186
.suggestions
178
- right - 0.5rem
187
+ right 0
188
+
189
+ @media (max-width : $MQMobileNarrow)
190
+ .search-box .suggestions
191
+ width calc (100vw - 4rem )
179
192
</style >
You can’t perform that action at this time.
0 commit comments