Skip to content

Commit

Permalink
refactor away from layouts package; misc cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Liam Stanley <[email protected]>
  • Loading branch information
lrstanley committed Sep 4, 2022
1 parent f7035eb commit a125a68
Show file tree
Hide file tree
Showing 16 changed files with 351 additions and 436 deletions.
1 change: 0 additions & 1 deletion public/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"unplugin-vue-components": "^0.22.4",
"vite": "^3.0.9",
"vite-plugin-pages": "^0.25.0",
"vite-plugin-vue-layouts": "^0.7.0",
"vue": "^3.2.38",
"vue-router": "^4.1.5"
},
Expand Down
88 changes: 0 additions & 88 deletions public/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions public/src/components/layout/bare.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<AnimateFade>
<slot />
</AnimateFade>
</template>

<script setup lang="ts"></script>

<style scoped></style>
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@
</AnimateFade>

<n-card v-else class="shadow drop-shadow-xl rounded-md" content-style="padding: 0;">
<router-view v-slot="{ Component, route }">
<AnimateFade>
<Suspense>
<component :is="Component" :key="route" />
<template #fallback>
<n-spin class="flex flex-auto justify-center items-center p-20">
<template #description> Loading... </template>
</n-spin>
</template>
</Suspense>
</AnimateFade>
</router-view>
<Suspense>
<slot />
<template #fallback>
<n-spin class="flex flex-auto justify-center items-center p-20">
<template #description> Loading... </template>
</n-spin>
</template>
</Suspense>
</n-card>

<div class="py-4 px-2 mb-3 text-right text-sm lg:mb-20">
Expand Down
11 changes: 0 additions & 11 deletions public/src/layouts/bare.vue

This file was deleted.

10 changes: 10 additions & 0 deletions public/src/lib/core/directives.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { App } from "vue"

const focus = {
mounted: (el: HTMLElement) =>
setTimeout(() => el.querySelector<HTMLElement>("input, textarea")?.focus(), 300),
}

export function registerDirectives(app: App) {
app.directive("focus", focus)
}
5 changes: 1 addition & 4 deletions public/src/lib/core/router.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { setupLayouts } from "virtual:generated-layouts"
import { createRouter, createWebHistory } from "vue-router"
import generatedRoutes from "~pages"
import { loadingBar } from "@/lib/core/status"

const routes = setupLayouts(generatedRoutes)

const router = createRouter({
history: createWebHistory("/"),
routes,
routes: generatedRoutes,
})

router.beforeEach(async (to, from, next) => {
Expand Down
100 changes: 0 additions & 100 deletions public/src/lib/data/sample-bulk.txt

This file was deleted.

4 changes: 0 additions & 4 deletions public/src/lib/directives/focus.ts

This file was deleted.

2 changes: 2 additions & 0 deletions public/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "uno.css"
import "@/css/main.css"
import { createPinia } from "pinia"
import { createApp } from "vue"
import { registerDirectives } from "@/lib/core/directives"
import router from "@/lib/core/router"
import App from "@/main.vue"
import { MotionPlugin } from "@vueuse/motion"
Expand All @@ -12,4 +13,5 @@ const app = createApp(App)
app.use(createPinia())
app.use(router)
app.use(MotionPlugin)
registerDirectives(app)
app.mount("#app")
Loading

0 comments on commit a125a68

Please sign in to comment.