Skip to content

Commit

Permalink
FEAT: Adding children layouts #31
Browse files Browse the repository at this point in the history
  • Loading branch information
isabellirosa committed Jul 12, 2024
1 parent bc47c69 commit 58bb7bd
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 75 deletions.
1 change: 0 additions & 1 deletion src/components/home/DefaultHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const templateStore = useTemplateStore();
<GraphImage />
</div>
</div>
<DefaultFooter />
</template>

<style scoped>
Expand Down
5 changes: 5 additions & 0 deletions src/layouts/BlankLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<main>
<RouterView/>
</main>
</template>
11 changes: 11 additions & 0 deletions src/layouts/DefaultLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup lang="ts">
import { DefaultHeader, DefaultFooter } from '@/components';
</script>

<template>
<main>
<DefaultHeader/>
<RouterView/>
<DefaultFooter/>
</main>
</template>
10 changes: 10 additions & 0 deletions src/layouts/GraphLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script setup lang="ts">
import { DefaultHeader } from '@/components';
</script>

<template>
<main>
<DefaultHeader/>
<RouterView/>
</main>
</template>
5 changes: 0 additions & 5 deletions src/pages/AboutView.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<script setup lang="ts">
import { DefaultHeader } from '@/components';
</script>

<template>
<DefaultHeader/>
<h1>About</h1>
</template>
5 changes: 0 additions & 5 deletions src/pages/ArticleView.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<script setup lang="ts">
import { DefaultHeader } from '@/components';
</script>

<template>
<DefaultHeader/>
<h1>Article</h1>
</template>
5 changes: 0 additions & 5 deletions src/pages/AuthorView.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<script setup lang="ts">
import { DefaultHeader } from '@/components';
</script>

<template>
<DefaultHeader/>
<h1>Author</h1>
</template>
6 changes: 0 additions & 6 deletions src/pages/FavoriteView.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<script setup lang="ts">
import { DefaultHeader, DefaultFooter } from '@/components';
</script>

<template>
<DefaultHeader/>
<h1>favorite</h1>
<DefaultFooter/>
</template>
3 changes: 1 addition & 2 deletions src/pages/GraphView.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { GraphContainer, PainelControl, DefaultHeader } from '@/components';
import { GraphContainer } from '@/components';
import { useAuth, useSetGraph } from '@/composables';
import { useGraphStore } from '@/stores';
Expand All @@ -12,7 +12,6 @@ useAuth();

<template>
<div>
<DefaultHeader/>
<div class="container">
<GraphContainer :nodes="currentConnections.nodes" :edges="currentConnections.edges" :configs="configs"/>
</div>
Expand Down
5 changes: 1 addition & 4 deletions src/pages/HomeView.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<script lang="ts" setup>
import { DefaultHeader, DefaultHome } from "@/components";
import { DefaultHome } from "@/components";
</script>
<template>
<DefaultHeader />
<DefaultHome />
</template>

<style scoped></style>
11 changes: 1 addition & 10 deletions src/pages/ProfileView.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
<script setup lang="ts">
</script>

<template>
<h1>Profile</h1>
</template>


<style scoped>
</style>
</template>
93 changes: 56 additions & 37 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,68 @@ const router = createRouter({
routes: [
{
path: '/',
name: 'home',
component: () => import('../pages/HomeView.vue')
component: () => import('../layouts/DefaultLayout.vue'),
children: [
{
path: '/',
name: 'home',
component: () => import('../pages/HomeView.vue'),
},
{
path: '/about',
name: 'about',
component: () => import('../pages/AboutView.vue'),
},
{
path: '/article',
name: 'article',
component: () => import('../pages/ArticleView.vue'),
},
{
path: '/author',
name: 'author',
component: () => import('../pages/AuthorView.vue'),
},
{
path: '/favorite',
name: 'favorite',
component: () => import('../pages/FavoriteView.vue'),
meta: {
requiresAuth: true
}
},
{
path: '/profile',
name: 'profile',
component: () => import('../pages/ProfileView.vue'),
meta: {
requiresAuth: true
}
},

],
},
{
path: '/graph',
name: 'graph',
component: () => import('../pages/GraphView.vue')
},
{
path: '/about',
name: 'about',
component: () => import('../pages/AboutView.vue')
},
{
path: '/article',
name: 'article',
component: () => import('../pages/ArticleView.vue')
},
{
path: '/author',
name: 'author',
component: () => import('../pages/AuthorView.vue')
},
{
path: '/favorite',
name: 'favorite',
component: () => import('../pages/FavoriteView.vue'),
meta: {
requiresAuth: true
}
},
{
path: '/profile',
name: 'profile',
component: () => import('../pages/ProfileView.vue'),
meta: {
requiresAuth: true
}
component: () => import('../layouts/GraphLayout.vue'),
children: [
{
path: '/',
name: 'graph',
component: () => import('../pages/GraphView.vue'),
},
]
},
{
path: '/login',
name: 'login',
component: () => import('../pages/LoginView.vue')
component: () => import('../layouts/BlankLayout.vue'),
children: [
{
path: '/',
name: 'login',
component: () => import('../pages/LoginView.vue'),
},
]
}
]
})
Expand Down

0 comments on commit 58bb7bd

Please sign in to comment.