From a2de94fb04aac71dfb8a819e9af78be10f0d165c Mon Sep 17 00:00:00 2001 From: Luke Harding Date: Thu, 9 May 2024 21:01:13 -0400 Subject: [PATCH] Basic vue frontend with routing --- client/README.md | 11 ++-- client/index.html | 4 +- client/package.json | 6 ++- client/public/vite.svg | 1 - client/src/App.vue | 35 +++++-------- client/src/assets/vue.svg | 1 - client/src/components/Footer.vue | 10 ++++ client/src/components/Header.vue | 63 +++++++++++++++++++++++ client/src/components/HelloWorld.vue | 38 -------------- client/src/main.ts | 3 +- client/src/router.ts | 16 ++++++ client/src/style.css | 77 +++------------------------- client/src/views/Home.vue | 3 ++ client/src/views/Login.vue | 3 ++ client/yarn.lock | 12 +++++ 15 files changed, 136 insertions(+), 147 deletions(-) delete mode 100644 client/public/vite.svg delete mode 100644 client/src/assets/vue.svg create mode 100644 client/src/components/Footer.vue create mode 100644 client/src/components/Header.vue delete mode 100644 client/src/components/HelloWorld.vue create mode 100644 client/src/router.ts create mode 100644 client/src/views/Home.vue create mode 100644 client/src/views/Login.vue diff --git a/client/README.md b/client/README.md index 0bfecb0..389f88f 100644 --- a/client/README.md +++ b/client/README.md @@ -1,9 +1,4 @@ -# Vue 3 + TypeScript + Vite +# Personal Tracker Frontend -This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 ` diff --git a/client/package.json b/client/package.json index 1aef060..0d679bb 100644 --- a/client/package.json +++ b/client/package.json @@ -9,12 +9,14 @@ "preview": "vite preview" }, "dependencies": { - "vue": "^3.4.21" + "vue": "^3.4.21", + "vue-router": "^4.3.2" }, "devDependencies": { "@vitejs/plugin-vue": "^5.0.4", "typescript": "^5.2.2", "vite": "^5.2.0", "vue-tsc": "^2.0.6" - } + }, + "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72" } diff --git a/client/public/vite.svg b/client/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/client/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/client/src/App.vue b/client/src/App.vue index bb666a8..16bf01b 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -1,30 +1,19 @@ + main { + flex: 1; + padding: 2ch; + } + \ No newline at end of file diff --git a/client/src/assets/vue.svg b/client/src/assets/vue.svg deleted file mode 100644 index 770e9d3..0000000 --- a/client/src/assets/vue.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/client/src/components/Footer.vue b/client/src/components/Footer.vue new file mode 100644 index 0000000..d5589b0 --- /dev/null +++ b/client/src/components/Footer.vue @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/client/src/components/Header.vue b/client/src/components/Header.vue new file mode 100644 index 0000000..9f71a0d --- /dev/null +++ b/client/src/components/Header.vue @@ -0,0 +1,63 @@ + + + + \ No newline at end of file diff --git a/client/src/components/HelloWorld.vue b/client/src/components/HelloWorld.vue deleted file mode 100644 index 7b25f3f..0000000 --- a/client/src/components/HelloWorld.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - diff --git a/client/src/main.ts b/client/src/main.ts index 2425c0f..7b19912 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -1,5 +1,6 @@ import { createApp } from 'vue' import './style.css' import App from './App.vue' +import router from './router' -createApp(App).mount('#app') +createApp(App).use(router).mount('#app') diff --git a/client/src/router.ts b/client/src/router.ts new file mode 100644 index 0000000..fd563f6 --- /dev/null +++ b/client/src/router.ts @@ -0,0 +1,16 @@ +import { createWebHistory, createRouter } from 'vue-router' + +import HomeView from './views/Home.vue' +import LoginView from './views/Login.vue' + +const routes = [ + { path: '/', component: HomeView }, + { path: '/login', component: LoginView } +] + +const router = createRouter({ + history: createWebHistory(), + routes, +}) + +export default router \ No newline at end of file diff --git a/client/src/style.css b/client/src/style.css index bb131d6..deb95d0 100644 --- a/client/src/style.css +++ b/client/src/style.css @@ -1,79 +1,14 @@ :root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; } -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} +html, body, #app { + margin: 0; + height: 100%; -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -.card { - padding: 2em; + font-family: monospace; } #app { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } + display: flex; + flex-direction: column; } diff --git a/client/src/views/Home.vue b/client/src/views/Home.vue new file mode 100644 index 0000000..5672e6a --- /dev/null +++ b/client/src/views/Home.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/client/src/views/Login.vue b/client/src/views/Login.vue new file mode 100644 index 0000000..aac9ba0 --- /dev/null +++ b/client/src/views/Login.vue @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/client/yarn.lock b/client/yarn.lock index 468a34b..c5b2e81 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -281,6 +281,11 @@ "@vue/compiler-dom" "3.4.27" "@vue/shared" "3.4.27" +"@vue/devtools-api@^6.5.1": + version "6.6.1" + resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.6.1.tgz#7c14346383751d9f6ad4bea0963245b30220ef83" + integrity sha512-LgPscpE3Vs0x96PzSSB4IGVSZXZBZHpfxs+ZA1d+VEPwHdOXowy/Y2CsvCAIFrf+ssVU1pD1jidj505EpUnfbA== + "@vue/language-core@2.0.16": version "2.0.16" resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-2.0.16.tgz#c059228e6a0a17b4505421da0e5747a4a04facbe" @@ -501,6 +506,13 @@ vite@^5.2.0: optionalDependencies: fsevents "~2.3.3" +vue-router@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.3.2.tgz#08096c7765dacc6832f58e35f7a081a8b34116a7" + integrity sha512-hKQJ1vDAZ5LVkKEnHhmm1f9pMiWIBNGF5AwU67PdH7TyXCj/a4hTccuUuYCAMgJK6rO/NVYtQIEN3yL8CECa7Q== + dependencies: + "@vue/devtools-api" "^6.5.1" + vue-template-compiler@^2.7.14: version "2.7.16" resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz#c81b2d47753264c77ac03b9966a46637482bb03b"