From 53d0099ffa99582f552d7dff5676734c965ceb05 Mon Sep 17 00:00:00 2001 From: John Campion Jr Date: Mon, 27 Mar 2023 14:31:54 -0400 Subject: [PATCH] feat(theme): add `page-top/bottom` and `doc-top/bottom` slots (#2139) --- docs/guide/extending-default-theme.md | 5 +++++ src/client/theme-default/Layout.vue | 6 ++++++ src/client/theme-default/components/VPContent.vue | 8 +++++++- src/client/theme-default/components/VPDoc.vue | 4 +++- src/client/theme-default/components/VPPage.vue | 2 ++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/guide/extending-default-theme.md b/docs/guide/extending-default-theme.md index c7459923..b568ca1d 100644 --- a/docs/guide/extending-default-theme.md +++ b/docs/guide/extending-default-theme.md @@ -160,6 +160,8 @@ export default { Full list of slots available in the default theme layout: - When `layout: 'doc'` (default) is enabled via frontmatter: + - `doc-top` + - `doc-bottom` - `doc-footer-before` - `doc-before` - `doc-after` @@ -178,6 +180,9 @@ Full list of slots available in the default theme layout: - `home-hero-after` - `home-features-before` - `home-features-after` +- When `layout: 'page'` is enabled via frontmatter: + - `page-top` + - `page-bottom` - On not found (404) page: - `not-found` - Always: diff --git a/src/client/theme-default/Layout.vue b/src/client/theme-default/Layout.vue index ba3572c9..2232e379 100644 --- a/src/client/theme-default/Layout.vue +++ b/src/client/theme-default/Layout.vue @@ -54,6 +54,9 @@ provide('hero-image-slot-exists', heroImageSlotExists) + + + @@ -65,6 +68,9 @@ provide('hero-image-slot-exists', heroImageSlotExists) + + + diff --git a/src/client/theme-default/components/VPContent.vue b/src/client/theme-default/components/VPContent.vue index bafb2321..31c3d1cb 100644 --- a/src/client/theme-default/components/VPContent.vue +++ b/src/client/theme-default/components/VPContent.vue @@ -21,7 +21,10 @@ const { hasSidebar } = useSidebar() > - + + + + @@ -33,6 +36,9 @@ const { hasSidebar } = useSidebar() + + + diff --git a/src/client/theme-default/components/VPDoc.vue b/src/client/theme-default/components/VPDoc.vue index a352445b..7c9109d8 100644 --- a/src/client/theme-default/components/VPDoc.vue +++ b/src/client/theme-default/components/VPDoc.vue @@ -19,6 +19,7 @@ const pageName = computed(() => class="VPDoc" :class="{ 'has-sidebar': hasSidebar, 'has-aside': hasAside }" > +
@@ -50,6 +51,7 @@ const pageName = computed(() =>
+ @@ -130,7 +132,7 @@ const pageName = computed(() => .aside-container { position: fixed; top: 0; - padding-top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 32px); + padding-top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + var(--vp-doc-top-height, 0px) + 32px); width: 224px; height: 100vh; overflow-x: hidden; diff --git a/src/client/theme-default/components/VPPage.vue b/src/client/theme-default/components/VPPage.vue index 015926b7..8e735fd0 100644 --- a/src/client/theme-default/components/VPPage.vue +++ b/src/client/theme-default/components/VPPage.vue @@ -1,5 +1,7 @@