2022-10-09 16:18:24 -05:00
|
|
|
<template>
|
|
|
|
<div class="w-screen h-screen max-w-full max-h-screen text-white bg-gradient overflow-hidden">
|
2024-01-07 12:43:15 -06:00
|
|
|
<side-nav :content="content" :is-mobile="isMobile" :is-open.sync="drawerOpen" />
|
|
|
|
|
2022-12-24 11:04:20 -06:00
|
|
|
<div id="guides-content" class="overflow-y-auto max-w-full overflow-x-hidden" style="scrollbar-gutter: stable">
|
|
|
|
<div class="w-full max-w-5xl mx-auto px-2 py-8">
|
2024-01-07 12:43:15 -06:00
|
|
|
<header-page-header :has-content="hasContent" :is-mobile="isMobile" @openDrawer="openDrawer" />
|
2022-10-09 16:18:24 -05:00
|
|
|
|
2022-12-24 11:04:20 -06:00
|
|
|
<Nuxt />
|
|
|
|
</div>
|
2022-10-09 16:18:24 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
async fetch() {
|
2024-01-07 12:43:15 -06:00
|
|
|
this.fetchContent()
|
2022-10-09 16:18:24 -05:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2024-01-07 12:43:15 -06:00
|
|
|
drawerOpen: false,
|
|
|
|
isMobile: false,
|
2024-01-05 13:53:02 -07:00
|
|
|
content: []
|
2022-10-09 16:18:24 -05:00
|
|
|
}
|
|
|
|
},
|
2024-01-05 15:55:51 -07:00
|
|
|
watch: {
|
2024-01-07 12:43:15 -06:00
|
|
|
$route(to, from) {
|
2024-01-05 15:55:51 -07:00
|
|
|
this.fetchContent()
|
2024-01-07 12:43:15 -06:00
|
|
|
if (this.isMobile) {
|
|
|
|
this.drawerOpen = false
|
|
|
|
}
|
2024-01-05 15:55:51 -07:00
|
|
|
}
|
|
|
|
},
|
2022-10-09 16:18:24 -05:00
|
|
|
computed: {
|
2024-01-07 12:43:15 -06:00
|
|
|
hasContent() {
|
|
|
|
return !!this.content.length
|
2022-10-09 16:18:24 -05:00
|
|
|
}
|
|
|
|
},
|
2024-01-05 15:55:51 -07:00
|
|
|
methods: {
|
2024-01-07 12:43:15 -06:00
|
|
|
openDrawer() {
|
|
|
|
this.drawerOpen = true
|
|
|
|
},
|
2024-01-05 15:55:51 -07:00
|
|
|
async fetchContent() {
|
|
|
|
if (this.$route.name === 'guides-id') {
|
|
|
|
this.content = await this.$content('guides').fetch()
|
2024-01-05 16:12:23 -07:00
|
|
|
} else if (this.$route.name === 'faq-id') {
|
|
|
|
this.content = await this.$content('faq').fetch()
|
2024-01-05 15:55:51 -07:00
|
|
|
} else {
|
2024-01-05 18:03:39 -07:00
|
|
|
this.content = []
|
2024-01-05 15:55:51 -07:00
|
|
|
}
|
2024-01-07 12:43:15 -06:00
|
|
|
|
|
|
|
// Sort pages by the markdown filename. e.g. "0.index.md" comes before "1.docker-windows.md"
|
|
|
|
this.content.sort((a, b) => {
|
|
|
|
const aDirname = a.path?.split('/').pop() || ''
|
|
|
|
const bDirname = b.path?.split('/').pop() || ''
|
|
|
|
return aDirname.localeCompare(bDirname, 'en', { numeric: true })
|
|
|
|
})
|
2024-01-05 15:55:51 -07:00
|
|
|
if (process.env.NODE_ENV === 'development') console.log('CONTENT', this.content)
|
2024-01-07 12:43:15 -06:00
|
|
|
},
|
|
|
|
resize() {
|
2025-03-10 17:14:11 -05:00
|
|
|
this.isMobile = window.innerWidth < 767 || window.innerHeight < 767
|
2024-01-07 12:43:15 -06:00
|
|
|
this.drawerOpen = !this.isMobile
|
2024-01-05 15:55:51 -07:00
|
|
|
}
|
|
|
|
},
|
2024-01-07 12:43:15 -06:00
|
|
|
mounted() {
|
|
|
|
this.resize()
|
|
|
|
window.addEventListener('resize', this.resize)
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
window.removeEventListener('resize', this.resize)
|
|
|
|
}
|
2022-10-09 16:18:24 -05:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
:root {
|
2024-01-07 12:43:15 -06:00
|
|
|
--sidebar-width: 288px;
|
2022-10-09 16:18:24 -05:00
|
|
|
}
|
|
|
|
#guides-content {
|
2024-01-07 12:43:15 -06:00
|
|
|
margin-left: var(--sidebar-width);
|
2022-10-09 16:18:24 -05:00
|
|
|
height: 100vh;
|
|
|
|
}
|
|
|
|
@media (max-width: 767px) {
|
|
|
|
#guides-content {
|
|
|
|
margin-left: 0px;
|
|
|
|
height: 100vh;
|
|
|
|
}
|
|
|
|
}
|
2023-01-23 23:33:14 +01:00
|
|
|
</style>
|