vue init commit

This commit is contained in:
zyxkad 2022-08-20 16:17:39 -06:00
parent 9217532286
commit 48fbdcc0f5
No known key found for this signature in database
GPG Key ID: 75D46E883711CD87
16 changed files with 1614 additions and 2 deletions

19
.gitignore vendored
View File

@ -135,3 +135,22 @@ bh_unicode_properties.cache
# https://packagecontrol.io/packages/sublime-github # https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings GitHub.sublime-settings
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/

View File

@ -1,3 +1,29 @@
# omm-web # omm-front
Web of Oh My Mailbox This template should help get you started developing with Vue 3 in Vite.
## Recommended IDE Setup
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## Customize configuration
See [Vite Configuration Reference](https://vitejs.dev/config/).
## Project Setup
```sh
npm install
```
### Compile and Hot-Reload for Development
```sh
npm run dev
```
### Compile and Minify for Production
```sh
npm run build
```

13
index.html Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>

1205
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

17
package.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "omm-front",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview --port 4173"
},
"dependencies": {
"vue": "^3.2.37",
"vue-router": "^4.1.3"
},
"devDependencies": {
"@vitejs/plugin-vue": "^3.0.1",
"vite": "^3.0.4"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

137
src/App.vue Normal file
View File

@ -0,0 +1,137 @@
<template>
<div class="body" v-bind:style="{'height': appHeight + 'px'}">
<div class="side-nav" v-bind:[navExpandedAttr]="''">
<div class="logo" v-on:click="triggerNavExpand">
<img alt="Vue logo" src="@/assets/logo.svg" width="100" height="100" />
</div>
<nav>
<RouterLink to="/">
<span class="nav-text">Index</span>
</RouterLink>
<RouterLink to="/about">
<span class="nav-text">About</span>
</RouterLink>
</nav>
</div>
<div class="content">
<RouterView class="content" />
</div>
</div>
</template>
<script>
import { RouterLink, RouterView } from 'vue-router'
export default {
data(){
return {
navExpanded: true,
}
},
computed: {
appHeight: {
get(){
return window.innerHeight;
}
},
navExpandedAttr: {
get(){
return this.navExpanded ?'expanded-nav' :null;
}
}
},
methods: {
triggerNavExpand(){
this.navExpanded = !this.navExpanded;
}
},
components: {
RouterLink,
RouterView
}
}
</script>
<style scoped>
.body {
display: flex;
flex-direction: row;
}
.side-nav {
width: 3rem;
padding: 0.5rem 0;
margin-right: 1rem;
box-shadow: 1px;
display: flex;
flex-direction: column;
align-items: flex-start;
}
.side-nav[expanded-nav] {
/*width: fit-content;*/
width: 12rem;
box-shadow: #000 0px 0px 20px 0px;
}
.logo {
box-sizing: content-box;
display: block;
width: 2rem;
height: 2rem;
padding: 0.5rem 0.7rem 0.5rem 0.8rem;
border: 1px solid var(--color-border);
border-left: none;
border-radius: 0 1.5rem 1.5rem 0;
}
.logo img {
display: block;
width: 100%;
height: 100%;
user-select: none;
}
.side-nav nav {
width: 100%;
display: flex;
flex-direction: column;
}
.side-nav nav a {
display: block;
height: 1.7rem;
padding: 0 0.5rem;
margin-left: 0.75rem;
border-left: 1px solid var(--color-border);
}
.side-nav nav .nav-text {
font-size: 1.1rem;
font-weight: 700;
}
.side-nav:not([expanded-nav]) nav .nav-text {
display: none;
}
.side-nav nav a.router-link-exact-active {
padding-left: 0.7rem;
}
.side-nav nav a.router-link-exact-active .nav-text {
color: var(--color-text);
font-weight: 900;
}
.side-nav nav a.router-link-exact-active:hover {
background-color: transparent;
}
.content {
display: flex;
flex-direction: column;
width: 100%;
margin-top: 1rem;
}
</style>

74
src/assets/base.css Normal file
View File

@ -0,0 +1,74 @@
/* color palette from <https://github.com/vuejs/theme> */
:root {
--vt-c-white: #ffffff;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;
--vt-c-black: #181818;
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;
--vt-c-indigo: #2c3e50;
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
}
/* semantic color variables for this project */
:root {
--color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute);
--color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1);
--color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1);
--section-gap: 160px;
}
@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute);
--color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1);
--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
}
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
position: relative;
font-weight: normal;
}
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition: color 0.5s, background-color 0.5s;
line-height: 1.6;
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

1
src/assets/logo.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69" xmlns:v="https://vecta.io/nano"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>

After

Width:  |  Height:  |  Size: 308 B

19
src/assets/main.css Normal file
View File

@ -0,0 +1,19 @@
@import "./base.css";
#app {
max-width: 1280px;
font-weight: normal;
}
a, .green {
text-decoration: none;
color: hsla(160, 100%, 37%, 1);
transition: 0.4s;
}
@media (hover: hover) {
a:hover {
background-color: hsla(160, 100%, 37%, 0.2);
}
}

34
src/components/Index.vue Normal file
View File

@ -0,0 +1,34 @@
<template>
<div class="greetings">
<h1 class="green">{{msg}}</h1>
<h3>
Youve successfully created a project with
<a target="_blank" href="https://vitejs.dev/">Vite</a> +
<a target="_blank" href="https://vuejs.org/">Vue 3</a>.
</h3>
</div>
</template>
<script>
export default {
props: ['msg']
}
</script>
<style scoped>
h1 {
font-weight: 500;
font-size: 2.6rem;
top: -10px;
}
h3 {
font-size: 1.2rem;
}
.greetings h1,
.greetings h3 {
text-align: center;
}
</style>

11
src/main.js Normal file
View File

@ -0,0 +1,11 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import './assets/main.css'
const app = createApp(App)
app.use(router)
app.mount('#app')

25
src/router/index.js Normal file
View File

@ -0,0 +1,25 @@
import { createRouter, createWebHistory } from 'vue-router'
import IndexView from '../views/IndexView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'index',
component: IndexView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue')
}
]
})
export default router

8
src/views/AboutView.vue Normal file
View File

@ -0,0 +1,8 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<style>
</style>

9
src/views/IndexView.vue Normal file
View File

@ -0,0 +1,9 @@
<template>
<main>
<Index msg="You did it!"/>
</main>
</template>
<script setup>
import Index from '@/components/Index.vue'
</script>

14
vite.config.js Normal file
View File

@ -0,0 +1,14 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})