Skip to content

Commit 4c17d68

Browse files
committed
feat: add OverviewContent component and update Layout.vue to support overview pages
1 parent 4ed8880 commit 4c17d68

File tree

2 files changed

+82
-14
lines changed

2 files changed

+82
-14
lines changed

packages/nimiq-vitepress-theme/src/layout/Layout.vue

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import DesktopHeader from './DesktopHeader.vue'
77
import MobileNav from './MobileNav.vue'
88
import MobileOutlineAccordion from './MobileOutlineAccordion.vue'
99
import NotFound from './NotFound.vue'
10+
import OverviewContent from './OverviewContent.vue'
1011
import PageContent from './PageContent.vue'
1112
import SecondarySidebar from './SecondarySidebar.vue'
1213
import Sidebar from './Sidebar.vue'
1314
1415
const { frontmatter, page } = useData()
1516
1617
const isHome = computed(() => frontmatter.value.layout === 'home')
18+
const isOverview = computed(() => frontmatter.value.layout === 'overview')
1719
const is404 = computed(() => page.value.isNotFound || frontmatter.value.layout === '404')
1820
const showSidebar = computed(() => {
1921
if (frontmatter.value.sidebar !== undefined)
@@ -33,8 +35,25 @@ const isMobileOrTablet = breakpoints.smaller('lg')
3335
<!-- 404 Not Found Page -->
3436
<NotFound v-if="is404" />
3537

36-
<!-- Documentation Pages -->
37-
<div v-else-if="!isHome" id="viewport" flex relative var:nq-sidebar-width:100vw md:var:nq-sidebar-width:288px data-layout="docs">
38+
<!-- Home Page -->
39+
<div v-else-if="isHome" data-layout="home" min-h-screen>
40+
<template v-if="isMobileOrTablet">
41+
<Content />
42+
<MobileNav fixed bottom-0 />
43+
</template>
44+
<template v-else>
45+
<DesktopHeader />
46+
<Content f-pt-xl />
47+
</template>
48+
</div>
49+
50+
<!-- Overview Pages -->
51+
<div v-else-if="isOverview" id="viewport" data-layout="overview" min-h-screen>
52+
<OverviewContent />
53+
</div>
54+
55+
<!-- Documentation Pages (default) -->
56+
<div v-else id="viewport" flex relative var:nq-sidebar-width:100vw md:var:nq-sidebar-width:288px data-layout="docs">
3857
<!-- TODO Add skip -->
3958
<div v-if="!isMobileOrTablet" flex w-full>
4059
<div shrink-0 relative w="$nq-sidebar-width">
@@ -71,16 +90,4 @@ const isMobileOrTablet = breakpoints.smaller('lg')
7190
<MobileNav fixed bottom-0 />
7291
</template>
7392
</div>
74-
75-
<!-- Home Page -->
76-
<div v-else data-layout="home" min-h-screen>
77-
<template v-if="isMobileOrTablet">
78-
<Content />
79-
<MobileNav fixed bottom-0 />
80-
</template>
81-
<template v-else>
82-
<DesktopHeader />
83-
<Content f-pt-xl />
84-
</template>
85-
</div>
8693
</template>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<script setup lang="ts">
2+
import { useBreakpoints } from '@vueuse/core'
3+
import { useData } from 'vitepress'
4+
import { computed } from 'vue'
5+
import MobileNav from './MobileNav.vue'
6+
import MobileOutlineAccordion from './MobileOutlineAccordion.vue'
7+
import Sidebar from './Sidebar.vue'
8+
import '../assets/code-blocks.css'
9+
import '../assets/typography.css'
10+
import '../assets/github-callouts.css'
11+
import 'nimiq-css/css/static-content.css'
12+
13+
const { frontmatter } = useData()
14+
15+
const showSidebar = computed(() => {
16+
if (frontmatter.value.sidebar !== undefined)
17+
return frontmatter.value.sidebar
18+
return true // Default to showing sidebar for overview pages
19+
})
20+
21+
const breakpoints = useBreakpoints({ lg: 1224 })
22+
const isMobileOrTablet = breakpoints.smaller('lg')
23+
</script>
24+
25+
<template>
26+
<div flex relative var:nq-sidebar-width:100vw md:var:nq-sidebar-width:288px>
27+
<!-- Desktop Layout -->
28+
<div v-if="!isMobileOrTablet" flex w-full>
29+
<div shrink-0 relative w="$nq-sidebar-width">
30+
<Sidebar v-if="showSidebar" w="$nq-sidebar-width" />
31+
</div>
32+
<main
33+
of-hidden dark:bg-neutral-1100 min-h-screen w-full flex-1 min-w-0
34+
:class="{
35+
'ml-[$nq-sidebar-width]': showSidebar,
36+
'ml-0': !showSidebar,
37+
'md:max-w-1220 md:mx-auto': !showSidebar,
38+
}"
39+
>
40+
<article h-full>
41+
<Content />
42+
</article>
43+
</main>
44+
</div>
45+
46+
<!-- Mobile Layout -->
47+
<template v-else>
48+
<div flex="~ col" size-full>
49+
<MobileOutlineAccordion />
50+
51+
<main dark:bg-neutral-1100 min-h-screen w-full>
52+
<article w-full max-w-none h-full>
53+
<Content />
54+
</article>
55+
</main>
56+
</div>
57+
58+
<MobileNav fixed bottom-0 />
59+
</template>
60+
</div>
61+
</template>

0 commit comments

Comments
 (0)