Skip to content

Commit

Permalink
feat: menu sections on the right for class/tuto
Browse files Browse the repository at this point in the history
  • Loading branch information
imanemessak committed Aug 11, 2023
1 parent a638bc5 commit 5ca8eb5
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 28 deletions.
66 changes: 46 additions & 20 deletions pages/[lang]/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,44 @@
<v-btn class="bg-primary rounded-pill lighten-4 mx-4"
variant="Flat"
href="https://github.com/IFB-ElixirFr/Wasm4Learn/discussions"
target="_blank">Help</v-btn>
target="_blank">Help
</v-btn>


<v-menu
open-on-hover
>
<template v-slot:activator="{ props }">
<v-btn
<v-btn
@click.stop="drawer = !drawer"
class="rounded-pill"
variant="tonal"
> {{ step + 1 }} / {{ tutosList.length }} </v-btn>
</template>
<v-list>
<v-list-item v-for="(n, key) in navigation" :key="key">
</v-list-item>
<v-list-item-title>{{ c2.title }}</v-list-item-title>
</v-list>
> {{ step + 1 }} / {{ tutosList.length }}
</v-btn>

</v-menu>
<!-- <v-btn
@click="menuDisplay"
class="rounded-pill"
variant="tonal"
> {{ step + 1 }} / {{ tutosList.length }} </v-btn> -->
<v-navigation-drawer v-model="drawer" absolute temporary>
<div v-for="(n, key) in navigation" :key="key">
<v-list-item
@click="changePath(section._path, c._dir)"
v-for="(s, Sectionkey) in n.children" :key="Sectionkey">
<v-list-item-content
v-for="(section, Skey) in s.children" :key="Skey">
<v-divider></v-divider>
<v-list-item-title>
{{ section.title }}</v-list-item-title>
<v-list-item-title
v-for="(n, nkey) in section.children" :key="nkey">
{{ n.title }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider></v-divider>
<!-- <v-list dense nav>
<v-list-item>
<v-list-item-content>
<v-list-item-title
v-for="(n, nkey) in section.children" :key="nkey"
class="text-h6"
>{{ n.title }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list> -->
</div>
</v-navigation-drawer>

</v-card-actions>

Expand Down Expand Up @@ -152,6 +166,7 @@ export default {
pyodideLoaded: false,
canvasArray: [],
canvasPos: 0,
drawer: null,
};
},
async setup() {
Expand Down Expand Up @@ -217,7 +232,14 @@ export default {
}
}
const contentFolder = await queryContent("/" + lang).find();
const { data: navigation } = await useAsyncData("navigation", () =>
fetchContentNavigation("/" + lang)
);
return {
contentFolder,
navigation,
webConsole,
tutosList,
store,
Expand Down Expand Up @@ -256,6 +278,10 @@ print("Welcome to the Pyodide terminal emulator 🐍\\n" + BANNER)
});
},
methods: {
changePath(pathParent, id) {
const router = useRouter();
router.push({ path: pathParent + "/", query: { id: id } });
},
changePlot(direction) {
this.updateCanvas();
if (direction == "next" && this.canvasPos + 1 < this.canvasArray.length) {
Expand Down
27 changes: 19 additions & 8 deletions pages/[lang]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
v-for="(c, keyC) in section.children"
:key="keyC"
width="350px"
class="ma-5 rounded-xl"
>
class="ma-5 rounded-xl">
<!-- @click="changePath(section._path, c._dir)"> -->
<v-card-text
class="text-h6"><strong>{{ c.title }}</strong></v-card-text>

<v-card-text>
<div v-if="c.belt">
<v-chip
Expand Down Expand Up @@ -47,10 +45,23 @@
{{ n.description }}
</v-card-text>
<v-card-actions class="justify-space-between">
<v-btn
@click="changePath(section._path, c._dir)"
class="lighten-4 mx-0"
><strong>Programme<v-icon color="info" class="mx-2" icon="mdi-plus"/></strong></v-btn>
<v-menu open-on-hover>
<template v-slot:activator="{ props }">
<v-btn
color="primary"
v-bind="props"
class="lighten-4 mx-0"
><strong>Programme<v-icon color="info" class="mx-2" icon="mdi-plus"/></strong>
</v-btn>
</template>
<v-list>
<v-list-item
@click="changePath(section._path, c._dir)"
v-for="(c2, keyC2) in c.children" :key="keyC2">
<v-list-item-title>{{ c2.title }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
<!-- <v-list v-for="(c2, keyC2) in c.children" :key="keyC2">
{{ c2.title }}
</v-list> -->
Expand Down Expand Up @@ -80,7 +91,7 @@ export default {
methods: {
changePath(pathParent, id) {
const router = useRouter();
router.push({ path: pathParent + "/", query: { id: id } });
router.push({ path: pathParent + "/", query: { id: id }});
},
},
};
Expand Down

0 comments on commit 5ca8eb5

Please sign in to comment.