Skip to content

Commit 6af4ee6

Browse files
committed
style: Update TheHeader to use DocSearch button
1 parent a8a13f8 commit 6af4ee6

File tree

5 files changed

+43
-39
lines changed

5 files changed

+43
-39
lines changed

src/.vuepress/theme/components/TheHeader.vue

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,57 @@
1414
itemprop="sameAs"
1515
:content="social.link"
1616
>
17-
<div class="flex flex-wrap w-full">
17+
<div class="flex flex-wrap w-full md:justify-between md:flex-no-wrap">
1818
<div
19-
class="flex items-center justify-end w-1/5 h-16 md:pl-0 md:w-1/12 lg:w-3/12"
19+
class="flex items-center justify-end"
2020
:class="{'header-logo--bg': bgSidebar, 'container-layout-pl lg:w-2/7': hasSidebar }"
2121
>
2222
<div class="w-full">
2323
<Logo />
2424
</div>
2525
</div>
2626
<div
27-
class="flex items-center flex-grow-0 w-3/5 h-16 md:pl-4 lg:pl-0 md:pr-0 md:w-auto md:flex-grow"
28-
:class="{ 'w-4/5': !hasSidebar }"
27+
class="flex items-center flex-1"
28+
:class="{ 'justify-between': hasSidebar, 'justify-end': !hasSidebar }"
2929
>
3030
<div
31-
class="w-full"
32-
:class="{ 'md:ml-8': hasSidebar }"
31+
class="flex items-center w-full md:mr-8 md:w-auto"
32+
:class="{
33+
'justify-end': !hasSidebar,
34+
'md:w-full md:max-w-lg lg:max-w-3xl': hasSidebar,
35+
}"
3336
>
34-
<AlgoliaSearch
35-
v-if="isAlgoliaSearch"
36-
:options="$themeConfig.algolia"
37-
/>
37+
<div
38+
class="w-full"
39+
:class="{ 'md:ml-8': hasSidebar }"
40+
>
41+
<AlgoliaSearch
42+
v-if="isAlgoliaSearch"
43+
:options="$themeConfig.algolia"
44+
/>
45+
</div>
3846
</div>
39-
</div>
40-
<div
41-
v-if="hasSidebar"
42-
class="flex items-center justify-end w-1/5 md:hidden"
43-
>
44-
<button
45-
type="button"
46-
class="flex px-4 py-3 mr-1 md:hidden"
47-
aria-controls="s-sidebar-wrapper"
48-
:aria-label="menuButtonAriaLabel"
49-
:aria-expanded="isSidebarOpen.toString()"
50-
@click="$emit('toggle-sidebar')"
47+
<div
48+
v-if="hasSidebar"
49+
class="flex items-center justify-end md:hidden"
5150
>
52-
<vp-icon
53-
:name="isSidebarOpen ? 'close' : 'menu'"
54-
size="23"
55-
/>
56-
</button>
51+
<button
52+
type="button"
53+
class="flex px-4 py-3 mr-1 md:hidden"
54+
aria-controls="s-sidebar-wrapper"
55+
:aria-label="menuButtonAriaLabel"
56+
:aria-expanded="isSidebarOpen.toString()"
57+
@click="$emit('toggle-sidebar')"
58+
>
59+
<vp-icon
60+
:name="isSidebarOpen ? 'close' : 'menu'"
61+
size="23"
62+
/>
63+
</button>
64+
</div>
5765
</div>
5866
<div
59-
class="flex items-center h-16 header-nav md:justify-end md:flex-grow"
67+
class="flex items-center h-16 header-nav"
6068
:class="{ 'container-layout-pr': hasSidebar }"
6169
>
6270
<TheNavigation />
@@ -121,10 +129,6 @@ export default {
121129
height: 65px;
122130
}
123131
124-
@media (max-width: theme('screens.lg')) {
125-
@apply pl-1 pr-3;
126-
}
127-
128132
&-logo--bg {
129133
@media (min-width: theme('screens.lg')) {
130134
@apply bg-page-gradient-left;

src/.vuepress/theme/components/TheNavigation.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<a
1717
:href="href"
1818
:aria-current="isActive && $route.path.indexOf(item.link) === 0 ? 'page' : null"
19-
class="px-3 py-3 border-b-4 border-transparent border-solid the-nav-link hover:border-accent-primary"
19+
class="flex px-3 py-3 border-b-4 border-transparent border-solid the-nav-link hover:border-accent-primary"
2020
:class="{ 'active border-accent-primary': isActive && $route.path.indexOf(item.link) === 0 }"
2121
@click="navigate"
2222
>
@@ -26,7 +26,7 @@
2626
</li>
2727
<li>
2828
<ExternalLink
29-
class="px-3 py-3 border-b-4 border-transparent border-solid the-nav-link hover:border-accent-primary"
29+
class="flex items-center px-3 border-b-4 border-transparent border-solid the-nav-link hover:border-accent-primary"
3030
:href="`https://github.com/vue-a11y`"
3131
label="Github"
3232
/>
@@ -44,7 +44,7 @@ export default {
4444
<style lang="scss">
4545
.the-nav {
4646
&-link {
47-
padding-top: 1rem;
47+
padding-top: 1.2rem;
4848
padding-bottom: 1.2rem;
4949
}
5050
}

src/.vuepress/theme/global-components/ExternalLink.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
target="_blank"
55
rel="noopener noreferrer"
66
>
7-
{{ label }}
7+
<span class="mr-1">{{ label }}</span>
88
<span class="sr-only">({{ $themeLocaleConfig.externalLinkText }})</span>
99
<OutboundLink />
1010
</a>

src/.vuepress/theme/layouts/Full.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="full-layout">
3-
<TheHeader class="md:px-4" />
3+
<TheHeader class="pl-1 pr-3 md:px-4" />
44
<TheMain>
55
<slot>
66
<component :is="$frontmatter.view || 'Home'" />

src/.vuepress/theme/layouts/Layout.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
has-sidebar
55
bg-sidebar
66
:is-sidebar-open="isSidebarOpen"
7-
class="relative z-10"
7+
class="relative"
88
@toggle-sidebar="toggleSidebar"
99
/>
1010

@@ -96,7 +96,7 @@ export default {
9696
}
9797
9898
@media (max-width: theme('screens.md')) {
99-
height: calc(100vh - 129px);
99+
height: calc(100vh - 118px);
100100
}
101101
102102
@screen md {

0 commit comments

Comments
 (0)