Add simple layout system

This commit is contained in:
zervo 2025-07-23 23:02:53 +02:00
parent 9fc70cfe57
commit 1b2f7a7941
3 changed files with 49 additions and 1 deletions

View file

@ -0,0 +1,16 @@
<!--
Alpacca: The modern package repository hosting platform.
Copyright (C) 2025, Zervó Zadachin
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
The full copyright notice can be found at https://git.zervo.org/zervo/Alpacca/src/branch/main/COPYRIGHT.
-->
<template>
<v-app>
<v-main>
<slot />
</v-main>
</v-app>
</template>

View file

@ -1,8 +1,18 @@
/*
Alpacca: The modern package repository hosting platform.
Copyright (C) 2025, Zervó Zadachin
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
The full copyright notice can be found at https://git.zervo.org/zervo/Alpacca/src/branch/main/COPYRIGHT.
*/
import { createRouter, createWebHistory } from 'vue-router'
import Index from '@/views/Index.vue'
import { withLayout } from './layoutWrapper'
const routes = [
{ path: '/', component: Index },
{ path: '/', component: withLayout(Index) },
]
const router = createRouter({

View file

@ -0,0 +1,22 @@
/*
Alpacca: The modern package repository hosting platform.
Copyright (C) 2025, Zervó Zadachin
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
The full copyright notice can be found at https://git.zervo.org/zervo/Alpacca/src/branch/main/COPYRIGHT.
*/
import { defineComponent, h } from 'vue'
import DefaultLayout from '@/layouts/DefaultLayout.vue'
export function withLayout (pageComponent: any, layoutComponent: any = DefaultLayout) {
return defineComponent({
name: 'WrappedWithLayout',
render () {
return h(layoutComponent, {}, {
default: () => h(pageComponent),
})
},
})
}