Skip to content

Commit

Permalink
fix(theme): broken layout on thinner viewports
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Oct 25, 2022
1 parent fd609f5 commit 640ee26
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 15 deletions.
10 changes: 7 additions & 3 deletions src/client/theme-default/components/VPContent.vue
Expand Up @@ -52,7 +52,7 @@ const NotFound = inject('NotFound')
.VPContent {
flex-grow: 1;
flex-shrink: 0;
margin: 0 auto;
margin: var(--vp-layout-top-height, 0) auto 0;
width: 100%;
}
Expand All @@ -61,13 +61,17 @@ const NotFound = inject('NotFound')
max-width: 100%;
}
.VPContent.has-sidebar {
margin: 0;
}
@media (min-width: 960px) {
.VPContent {
padding-top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px));
padding-top: var(--vp-nav-height);
}
.VPContent.has-sidebar {
margin: 0;
margin: var(--vp-layout-top-height, 0) 0 0;
padding-left: var(--vp-sidebar-width);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/client/theme-default/components/VPDoc.vue
Expand Up @@ -120,8 +120,8 @@ provide('onContentUpdated', onContentUpdated)
.aside-container {
position: sticky;
top: 0;
margin-top: calc((var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px)) * -1 - 32px);
padding-top: calc(var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px) + 32px);
margin-top: calc((var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0)) * -1 - 32px);
padding-top: calc(var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0) + 32px);
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
Expand All @@ -144,7 +144,7 @@ provide('onContentUpdated', onContentUpdated)
.aside-content {
display: flex;
flex-direction: column;
min-height: calc(100vh - (var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0px) + 32px));
min-height: calc(100vh - (var(--vp-nav-height-desktop) + var(--vp-layout-top-height, 0) + 32px));
padding-bottom: 32px;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPFlyout.vue
Expand Up @@ -119,7 +119,7 @@ function onBlur() {
}
.option-icon {
margin-right: 0px;
margin-right: 0;
width: 16px;
height: 16px;
fill: currentColor;
Expand Down
8 changes: 4 additions & 4 deletions src/client/theme-default/components/VPHero.vue
Expand Up @@ -53,19 +53,19 @@ defineProps<{

<style scoped>
.VPHero {
margin-top: calc((var(--vp-nav-height) + var(--vp-layout-top-height, 0px)) * -1);
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 48px) 24px 48px;
margin-top: calc((var(--vp-nav-height) + var(--vp-layout-top-height, 0)) * -1);
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0) + 48px) 24px 48px;
}
@media (min-width: 640px) {
.VPHero {
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 80px) 48px 64px;
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0) + 80px) 48px 64px;
}
}
@media (min-width: 960px) {
.VPHero {
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 80px) 64px 64px;
padding: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0) + 80px) 64px 64px;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/client/theme-default/components/VPLocalNav.vue
Expand Up @@ -48,6 +48,7 @@ function scrollToTop() {
width: 100%;
background-color: var(--vp-c-bg);
transition: border-color 0.5s, background-color 0.5s;
margin-top: var(--vp-layout-top-height, 0);
}
@media (min-width: 960px) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPNav.vue
Expand Up @@ -29,7 +29,7 @@ provide('close-screen', closeScreen)
<style scoped>
.VPNav {
position: relative;
top: var(--vp-layout-top-height, 0px);
top: var(--vp-layout-top-height, 0);
left: 0;
z-index: var(--vp-z-index-nav);
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPNavScreen.vue
Expand Up @@ -43,7 +43,7 @@ function unlockBodyScroll() {
<style scoped>
.VPNavScreen {
position: fixed;
top: calc(var(--vp-nav-height-mobile) + var(--vp-layout-top-height, 0px));
top: calc(var(--vp-nav-height-mobile) + var(--vp-layout-top-height, 0));
right: 0;
bottom: 0;
left: 0;
Expand Down
Expand Up @@ -107,7 +107,7 @@ function toggle() {
}
.group:first-child {
padding-top: 0px;
padding-top: 0;
}
.group + .group,
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPSidebar.vue
Expand Up @@ -59,7 +59,7 @@ watchPostEffect(async () => {
<style scoped>
.VPSidebar {
position: fixed;
top: var(--vp-layout-top-height, 0px);
top: var(--vp-layout-top-height, 0);
bottom: 0;
left: 0;
z-index: var(--vp-z-index-sidebar);
Expand Down

0 comments on commit 640ee26

Please sign in to comment.