Skip to content

Commit a469132

Browse files
committed
feat(ui): basic sidebar working
1 parent ca2c78b commit a469132

File tree

6 files changed

+38
-43
lines changed

6 files changed

+38
-43
lines changed

app.vue

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<script setup>
22
import { useRoute } from 'vue-router'
3-
import Roadmap from './components/Roadmap.vue'
4-
import HeroSection from './layouts/hero.vue'
53
64
const route = useRoute()
75
const nodeId = route.params.slug

components/FullView.vue

-12
This file was deleted.

components/Roadmap.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
const roadmapNodes = ref([
1313
{ id: 'topics', type: 'topics', position: { x: 0, y: -150 }, data: { topicLevel: 'start' } },
1414
...data.value.map(({ title, _path, data: { position, width, sourcePosition, targetPosition, topicLevel, type, align } }) => (
15-
{ id: _path.substring(1).replaceAll('/', "-").replaceAll('_', ''), type, position, width, label: title, data: { align, topicLevel, sourcePosition, targetPosition } }
15+
{ id: _path.substring(1), type, position, width, label: title, data: { align, topicLevel, sourcePosition, targetPosition } }
1616
))
1717
])
1818

components/Sidebar.vue

-10
This file was deleted.

pages/[slug].vue

+27-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
<template>
2-
<div class="sticky right-0 top-0 z-40 w-screen min-h-screen">
3-
<Sidebar v-if="showSidebar" :node="nodeData" />
4-
<FullView v-else :node="nodeData" />
2+
<div class="fixed right-0 top-0 z-40 w-screen h-screen">
3+
<div
4+
v-if="content"
5+
class="right-0 top-0 flex h-full w-full overflow-y-auto flex-col items-center bg-white p-4 focus:outline-0 sm:p-6"
6+
>
7+
<ContentRenderer :key="content._id" :value="content">
8+
<ContentRendererMarkdown class="flex flex-col gap-3 text-black m:max-w-[800px] sm:max-w-[600px]" :value="content" />
9+
<div class="flex flex-col items-start w-full m:max-w-[800px] sm:max-w-[600px]">
10+
<h4 id="related-content" class="text-black mb-3">
11+
<a href="#related-content">Contenido Extra Relacionado</a>
12+
</h4>
13+
<a
14+
class="text-black mb-1"
15+
v-for="(link, i) in content.data.externalLinks"
16+
:key="i"
17+
:href="link.link"
18+
>
19+
<span v-if="link.english">[Contenido en Ingles]</span>
20+
{{link.name}}
21+
</a>
22+
</div>
23+
</ContentRenderer>
24+
</div>
525
</div>
626
<Header />
727
<HeroSection />
@@ -11,29 +31,18 @@
1131
<script setup>
1232
import { useRoute } from 'vue-router'
1333
import { ref, onMounted } from 'vue'
14-
import Sidebar from '@/components/Sidebar.vue'
15-
import FullView from '@/components/FullView.vue'
1634
import Roadmap from '@/components/Roadmap.vue'
1735
import HeroSection from '@/layouts/hero.vue'
1836
1937
const route = useRoute()
2038
const nodeId = route.params.slug
21-
const nodeData = ref(null)
2239
const showSidebar = ref(true)
40+
const content = ref(null)
2341
2442
onMounted(async () => {
25-
// Fetch the node data based on the nodeId
26-
const response = await fetchNodeData(nodeId)
27-
nodeData.value = response
43+
content.value = await queryContent(nodeId).findOne()
44+
console.log(content)
2845
29-
showSidebar.value = response && (route.query.fromClick || false)
46+
showSidebar.value = content && (route.query.fromClick || false)
3047
})
31-
32-
async function fetchNodeData(id) {
33-
return {
34-
id,
35-
title: 'Nodo ' + id,
36-
content: 'Contenido del nodo ' + id
37-
}
38-
}
3948
</script>

pages/index.vue

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<template>
2+
<Header />
3+
<HeroSection />
4+
<Roadmap />
5+
</template>
6+
7+
<script setup>
8+
import Roadmap from '@/components/Roadmap.vue'
9+
import HeroSection from '@/layouts/hero.vue'
10+
</script>

0 commit comments

Comments
 (0)