Skip to content

Commit a29a4a6

Browse files
ylw5brc-dd
andauthoredOct 24, 2022
feat(theme): add --vt-layout-top-height to adjust banner (#1521)
Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
1 parent b4199bc commit a29a4a6

File tree

7 files changed

+15
-14
lines changed

7 files changed

+15
-14
lines changed
 

‎src/client/theme-default/components/VPContent.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const NotFound = inject('NotFound')
6363
6464
@media (min-width: 960px) {
6565
.VPContent {
66-
padding-top: var(--vp-nav-height);
66+
padding-top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px));
6767
}
6868
6969
.VPContent.has-sidebar {

‎src/client/theme-default/components/VPDoc.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ provide('onContentUpdated', onContentUpdated)
120120
.aside-container {
121121
position: sticky;
122122
top: 0;
123-
margin-top: calc(var(--vp-nav-height-desktop) * -1 - 32px);
124-
padding-top: calc(var(--vp-nav-height-desktop) + 32px);
123+
margin-top: calc((var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px)) * -1 - 32px);
124+
padding-top: calc(var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px) + 32px);
125125
height: 100vh;
126126
overflow-x: hidden;
127127
overflow-y: auto;
@@ -144,7 +144,7 @@ provide('onContentUpdated', onContentUpdated)
144144
.aside-content {
145145
display: flex;
146146
flex-direction: column;
147-
min-height: calc(100vh - (var(--vp-nav-height-desktop) + 32px));
147+
min-height: calc(100vh - (var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px) + 32px));
148148
padding-bottom: 32px;
149149
}
150150

‎src/client/theme-default/components/VPHero.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ defineProps<{
5353

5454
<style scoped>
5555
.VPHero {
56-
margin-top: calc(var(--vp-nav-height) * -1);
57-
padding: calc(var(--vp-nav-height) + 48px) 24px 48px;
56+
margin-top: calc((var(--vp-nav-height) + var(--vp-layout-top-height, 0px)) * -1);
57+
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 48px) 24px 48px;
5858
}
5959
6060
@media (min-width: 640px) {
6161
.VPHero {
62-
padding: calc(var(--vp-nav-height) + 80px) 48px 64px;
62+
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 80px) 48px 64px;
6363
}
6464
}
6565
6666
@media (min-width: 960px) {
6767
.VPHero {
68-
padding: calc(var(--vp-nav-height) + 80px) 64px 64px;
68+
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 80px) 64px 64px;
6969
}
7070
}
7171

‎src/client/theme-default/components/VPNav.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ provide('close-screen', closeScreen)
2929
<style scoped>
3030
.VPNav {
3131
position: relative;
32-
top: 0;
32+
top: var(--vp-layout-top-height, 0px);
3333
left: 0;
3434
z-index: var(--vp-z-index-nav);
3535
width: 100%;

‎src/client/theme-default/components/VPNavScreen.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function unlockBodyScroll() {
4343
<style scoped>
4444
.VPNavScreen {
4545
position: fixed;
46-
top: var(--vp-nav-height-mobile);
46+
top: calc(var(--vp-nav-height-mobile) + var(--vp-layout-top-height, 0px));
4747
right: 0;
4848
bottom: 0;
4949
left: 0;

‎src/client/theme-default/components/VPSidebar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ watchPostEffect(async () => {
5959
<style scoped>
6060
.VPSidebar {
6161
position: fixed;
62-
top: 0;
62+
top: var(--vp-layout-top-height, 0px);
6363
bottom: 0;
6464
left: 0;
6565
z-index: var(--vp-z-index-sidebar);

‎src/client/theme-default/styles/vars.css

+4-3
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,10 @@
172172
:root {
173173
--vp-z-index-local-nav: 10;
174174
--vp-z-index-nav: 20;
175-
--vp-z-index-backdrop: 30;
176-
--vp-z-index-sidebar: 40;
177-
--vp-z-index-footer: 50;
175+
--vp-z-index-layout-top: 30;
176+
--vp-z-index-backdrop: 40;
177+
--vp-z-index-sidebar: 50;
178+
--vp-z-index-footer: 60;
178179
}
179180

180181
/**

0 commit comments

Comments
 (0)
Please sign in to comment.