Skip to content

Commit 63d857e

Browse files
committed
feat: update mvc documentation
1 parent 892db12 commit 63d857e

File tree

14 files changed

+717
-108
lines changed

14 files changed

+717
-108
lines changed

.vitepress/config/sidebar.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const sidebar = [
5050
// collapsed: true,
5151
items: [
5252
{ text: 'Basic Routing', link: '/docs/routing/' },
53-
{ text: 'Routing in Leaf MVC', link: '/docs/routing/mvc' },
5453
{ text: 'Route Groups', link: '/docs/routing/route-groups' },
5554
{ text: 'Dynamic routing', link: '/docs/routing/dynamic' },
5655
{ text: 'Middleware', link: '/docs/routing/middleware/' },
@@ -148,14 +147,13 @@ const sidebar = [
148147
],
149148
},
150149
{
151-
text: 'Leaf MVC',
150+
text: 'Building to scale',
152151
// collapsible: true,
153152
// collapsed: true,
154153
items: [
155154
{ text: 'Leaf + MVC', link: '/docs/mvc/' },
156-
{ text: 'MVC Config', link: '/docs/mvc/config' },
157155
{ text: 'Controllers', link: '/docs/mvc/controllers' },
158-
{ text: 'Views', link: '/docs/frontend/mvc' },
156+
// { text: 'Views', link: '/docs/frontend/mvc' },
159157
{ text: 'Models', link: '/docs/database/models' },
160158
{ text: 'Migrations', link: '/docs/database/migrations' },
161159
{ text: 'Schema', link: '/docs/database/schema' },
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<script setup lang="ts">
2+
import { useElementSize } from '@vueuse/core';
3+
import { ref, watchEffect } from 'vue';
4+
5+
defineProps<{
6+
version: string;
7+
}>();
8+
9+
const el = ref<HTMLElement>();
10+
const { height } = useElementSize(el);
11+
12+
watchEffect(() => {
13+
if (height.value) {
14+
document.documentElement.style.setProperty(
15+
'--vp-layout-top-height',
16+
`${height.value + 16}px`
17+
);
18+
}
19+
});
20+
21+
const dismiss = () => {
22+
localStorage.setItem(
23+
'leaf-version-banner',
24+
(Date.now() + 8.64e7 * 1).toString() // current time + 1 day
25+
);
26+
27+
document.documentElement.classList.add('banner-dismissed');
28+
};
29+
</script>
30+
31+
<template>
32+
<div ref="el" class="banner">
33+
<div class="text">
34+
WARNING You're browsing the documentation for an upcoming version of Leaf. The documentation and features of this release are subject to change.
35+
</div>
36+
37+
<button type="button" @click="dismiss">
38+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
39+
<path
40+
d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" />
41+
</svg>
42+
</button>
43+
</div>
44+
</template>
45+
46+
<style>
47+
.banner-dismissed {
48+
--vp-layout-top-height: 0px !important;
49+
}
50+
51+
html {
52+
--vp-layout-top-height: 88px;
53+
}
54+
55+
@media (min-width: 375px) {
56+
html {
57+
--vp-layout-top-height: 64px;
58+
}
59+
}
60+
61+
@media (min-width: 768px) {
62+
html {
63+
--vp-layout-top-height: 40px;
64+
}
65+
}
66+
</style>
67+
68+
<style scoped>
69+
.banner-dismissed .banner {
70+
display: none;
71+
}
72+
73+
.banner {
74+
position: fixed;
75+
top: 0;
76+
right: 0;
77+
left: 0;
78+
z-index: var(--vp-z-index-layout-top);
79+
padding: 8px;
80+
text-align: center;
81+
background: var(--vp-c-banner);
82+
color: #fff;
83+
display: flex;
84+
justify-content: space-between;
85+
}
86+
87+
.text {
88+
flex: 1;
89+
font-size: 14px;
90+
}
91+
92+
a {
93+
text-decoration: underline;
94+
}
95+
96+
svg {
97+
width: 20px;
98+
height: 20px;
99+
margin-left: 8px;
100+
}
101+
</style>

.vitepress/theme/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ import { VueWriter } from 'vue-writer';
33

44
import 'virtual:group-icons.css';
55
import './styles/index.css';
6+
import { defineAsyncComponent, h } from 'vue';
67

78
/** @type {import('vitepress').Theme} */
89
export default {
910
extends: DefaultTheme,
1011
enhanceApp({ app }: any) {
1112
app.component('vue-writer', VueWriter);
1213
},
14+
Layout() {
15+
return h(DefaultTheme.Layout, null, {
16+
'layout-top': () =>
17+
h(defineAsyncComponent(() => import('./components/shared/Banner.vue'))),
18+
});
19+
},
1320
};

.vitepress/theme/styles/index.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#3077c6,
1111
#3eaf7c
1212
);
13+
--vp-c-banner: var(--vp-c-brand-1);
1314
--vp-home-hero-name-background: #3eaf7c;
1415
--vp-c-brand-1: #3eaf7c;
1516
--vp-c-brand-2: #07c16b;
@@ -35,6 +36,7 @@
3536
}
3637

3738
html.dark {
39+
--vp-c-banner: var(--vp-c-bg-soft);
3840
--vp-code-color: #3eaf7c;
3941
--vp-c-bg: #001e26;
4042
--vp-c-bg-alt: #001318;
@@ -132,3 +134,15 @@ html.dark {
132134
.VPContent.is-home + .VPFooter {
133135
background-color: var(--vp-c-bg-alt);
134136
}
137+
138+
.VPSidebar .group, .VPNavBarTitle.has-sidebar a {
139+
@apply !border-none;
140+
}
141+
142+
.VPNavBarTitle.has-sidebar a {
143+
@apply !text-lg;
144+
}
145+
146+
.VPNavBarTitle.has-sidebar img {
147+
@apply !w-8 !h-8;
148+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"@headlessui/tailwindcss": "^0.2.1",
1414
"@headlessui/vue": "^1.7.22",
15+
"@vueuse/core": "^11.1.0",
1516
"axios": "^1.7.7",
1617
"class-variance-authority": "^0.7.0",
1718
"clsx": "^2.1.1",

pnpm-lock.yaml

Lines changed: 32 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)