Updates CSS for a better link tracker app

master
androiddrew 7 years ago
parent bdfc51c3d9
commit 5feadc1d72

@ -1,29 +1,11 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view/>
</div>
</template>
<style lang="scss">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
}
}
</style>

@ -1,56 +1,76 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://github.com/vuejs/vue-cli/tree/dev/docs" target="_blank">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank">babel</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org/en/essentials/getting-started.html" target="_blank">vue-router</a></li>
<li><a href="https://vuex.vuejs.org/en/intro.html" target="_blank">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org/en" target="_blank">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li>
</ul>
<div class="left">
<h1>{{ title }}</h1>
<ul>
<li v-for="(link, index) in links" v-bind:key="index">
{{ link }}
</li>
</ul>
</div>
<div class="right">
<stats></stats>
</div>
</div>
</template>
<script>
import Stats from '@/components/Stats.vue'
import { mapState } from 'vuex'
export default {
name: 'HelloWorld',
props: {
msg: String
}
components:{
Stats
},
computed: {
...mapState([
'title',
'links'
]),
// Other stuff
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
<style>
html, #app, .home {
height: 100%;
}
body {
background-color: #F4F4F4;
margin: 0;
height: 100%;
}
.hello {
display: grid;
grid-template-columns: repeat(2, 50%);
grid-template-rows: 100%;
grid-template-areas:
"left right";
height: 100%;
}
.left, .right {
padding: 30px;
}
ul {
list-style-type: none;
padding: 0;
}
ul li {
padding: 20px;
background: white;
margin-bottom: 8px;
}
.right {
grid-area: right;
background-color: #E9E9E9;
}
</style>

@ -0,0 +1,39 @@
<template>
<div class="stats">
<h1>A different component</h1>
<p>There are currently {{ countLinks }} links</p>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'Stats',
computed: {
...mapGetters([
'countLinks'
]),
// Other stuff
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

@ -5,7 +5,15 @@ Vue.use(Vuex)
export default new Vuex.Store({
state: {
title: 'My Custom Title',
links: [
'https://google.com',
'https://coursetro.com',
'https://youtube.com',
]
},
getters: {
countLinks: state => { return state.links.length }
},
mutations: {

@ -1,6 +1,5 @@
<template>
<div class="home">
<img src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>

Loading…
Cancel
Save