Skip to content

Commit d311719

Browse files
authored
Merge pull request #3 from pierrechls/revert-2-feature/improve-template
Revert "Improve template"
2 parents 34bea0f + f5e45d9 commit d311719

30 files changed

+433
-98
lines changed

template/build/webpack.base.conf.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ module.exports = {
2929
'src': path.resolve(__dirname, '../src'),
3030
'assets': path.resolve(__dirname, '../src/assets'),
3131
'components': path.resolve(__dirname, '../src/components'),
32-
'views': path.resolve(__dirname, '../src/views'),
3332
'settings': path.resolve(__dirname, '../settings'),
3433
'locales': path.resolve(__dirname, '../locales'),
3534
'data': path.resolve(__dirname, '../src/data'),

template/locales/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue from 'vue'
22
import VueI18n from 'vue-i18n'
3-
import store from 'src/store'
3+
import store from 'src/vuex/store'
44

55
Vue.use(VueI18n)
66
Vue.config.lang = store.state.lang

template/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"vue": "^2.0.0",
4141
"vue-i18n": "^4.5.0",
4242
"vue-router": "^2.0.0",
43-
"vuex": "^2.0.0",
44-
"vuex-router-sync": "^3.0.0"
43+
"vuex": "^1.0.0-rc.2"
4544
},
4645
"devDependencies": {
4746
"babel-core": "^6.0.0",

template/src/App.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<div id="app">
33
<menu-app></menu-app>
4-
<transition name="fade" mode="out-in">
4+
<!-- <transition name="default"> -->
55
<router-view></router-view>
6-
</transition>
6+
<!-- <transition> -->
77
</div>
88
</template>
99

@@ -26,4 +26,3 @@
2626
</script>
2727

2828
<style lang="scss" src="assets/styles/app.scss"></style>
29-
<style lang="scss" src="src/transitions/fade.scss"></style>
54.8 KB
Binary file not shown.
36.4 KB
Binary file not shown.
Binary file not shown.

template/src/assets/fonts/glyphicons/glyphicons-halflings-regular.svg

Lines changed: 288 additions & 0 deletions
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.

template/src/assets/styles/app.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ body {
2525
color: $green;
2626
max-width: 250px;
2727
height: 400px;
28-
font-family: 'Open Sans', Helvetica, sans-serif;
28+
font-family: 'Futura', Helvetica, sans-serif;
2929
text-align: center;
3030
position: relative;
3131

template/src/assets/styles/fonts.scss

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
1+
@font-face {
2+
font-family: 'Futura';
3+
src: url('~assets/fonts/futura/FuturaBkBt.otf');
4+
src: url('~assets/fonts/futura/FuturaBkBt.ttf') format('truetype')
5+
}
26

37
@font-face {
4-
font-family: 'Open Sans', sans-serif;
8+
font-family: 'Glyphicons Halflings';
9+
src: url('~assets/fonts/glyphicons/glyphicons-halflings-regular.eot');
10+
src: url('~assets/fonts/glyphicons/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
11+
url('~assets/fonts/glyphicons/glyphicons-halflings-regular.woff2') format('woff2'),
12+
url('~assets/fonts/glyphicons/glyphicons-halflings-regular.woff') format('woff'),
13+
url('~assets/fonts/glyphicons/glyphicons-halflings-regular.ttf') format('truetype'),
14+
url('~assets/fonts/glyphicons/glyphicons-halflings-regular.svg#@{icon-font-svg-id}') format('svg');
515
}

template/src/views/Garden.vue renamed to template/src/components/Garden.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
<script>
1010
11+
import { getSeed } from 'src/vuex/getters'
12+
1113
export default {
1214
name: 'Garden',
13-
computed: {
14-
seedNumber() {
15-
return this.$store.state.seed
15+
vuex: {
16+
getters: {
17+
seedNumber: getSeed
1618
}
1719
}
1820
}
File renamed without changes.

template/src/components/LangSwitcher.vue

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,17 @@
77

88
<script>
99
10+
import { getLang } from 'src/vuex/getters'
11+
import { translate } from 'src/vuex/actions'
12+
1013
export default {
1114
name: 'LangSwitcher',
12-
computed: {
13-
lang() {
14-
return this.$store.state.lang
15-
}
16-
},
17-
methods: {
18-
translate: function (lang) {
19-
this.$store.dispatch('translate', lang)
15+
vuex: {
16+
getters: {
17+
lang: getLang
2018
},
21-
pullUp: function () {
22-
this.$store.dispatch('translate', lang)
19+
actions: {
20+
translate
2321
}
2422
}
2523
}

template/src/views/Plant.vue renamed to template/src/components/Plant.vue

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
<script>
1111
12+
import { plant, pullUp } from 'src/vuex/actions'
13+
import { getSeed } from 'src/vuex/getters'
1214
import settings from 'lib/settings'
1315
1416
export default {
@@ -19,17 +21,13 @@
1921
minSeed: 0
2022
}
2123
},
22-
computed: {
23-
seedNumber() {
24-
return this.$store.state.seed
25-
}
26-
},
27-
methods: {
28-
plant: function () {
29-
this.$store.dispatch('plant')
24+
vuex: {
25+
getters: {
26+
seedNumber: getSeed
3027
},
31-
pullUp: function () {
32-
this.$store.dispatch('pullUp')
28+
actions: {
29+
plant,
30+
pullUp
3331
}
3432
}
3533
}

template/src/data/.gitkeep

Whitespace-only changes.

template/src/router/routes.js renamed to template/src/data/routes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import Home from 'views/Home'
2-
import Plant from 'views/Plant'
3-
import Garden from 'views/Garden'
1+
import Home from 'components/Home'
2+
import Plant from 'components/Plant'
3+
import Garden from 'components/Garden'
44

55
module.exports = [
66
{

template/src/router/index.js renamed to template/src/lib/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue from 'vue'
22
import VueRouter from 'vue-router'
3-
import routes from './routes'
3+
import routes from 'data/routes'
44

55
Vue.use(VueRouter)
66

template/src/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import App from 'src/App'
33

44
// Global vue stuffs
55
import 'gsap'
6+
import 'src/transitions'
67
import 'locales/index'
78

89
// Routing
9-
import router from 'src/router'
10+
import router from 'lib/router'
1011

1112
// Store
12-
import store from 'src/store'
13+
import store from 'src/vuex/store'
1314

1415
new Vue({
1516
el: '#app',

template/src/store/index.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

template/src/transitions/default.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import Vue from 'vue'
2+
3+
Vue.component('default', {
4+
css: false,
5+
template: '\
6+
<transition\
7+
name="default"\
8+
mode="out-in"\
9+
v-on:before-enter="beforeEnter"\
10+
v-on:enter="enter"\
11+
v-on:after-enter="afterEnter"\
12+
v-on:enter-cancelled="enterCancelled"\
13+
v-on:before-leave="beforeLeave"\
14+
v-on:leave="leave"\
15+
v-on:after-leave="afterLeave"\
16+
v-on:leave-cancelled="leaveCancelled"\
17+
>\
18+
<slot></slot>\
19+
</transition>\
20+
',
21+
methods: {
22+
beforeEnter: function (el) {
23+
// ...
24+
},
25+
enter: function (el, done) {
26+
TweenMax.fromTo(el, 0.5, {opacity: 0}, {opacity: 1, onComplete: function () {
27+
done()
28+
}}).delay(0.2)
29+
},
30+
afterEnter: function (el) {
31+
// ...
32+
},
33+
enterCancelled: function (el) {
34+
// ...
35+
},
36+
37+
beforeLeave: function (el) {
38+
// ...
39+
},
40+
leave: function (el, done) {
41+
TweenMax.fromTo(el, 0.2, {opacity: 1}, {opacity: 0, onComplete: function () {
42+
done()
43+
}})
44+
},
45+
afterLeave: function (el) {
46+
// ...
47+
},
48+
leaveCancelled: function (el) {
49+
// ...
50+
}
51+
}
52+
})

template/src/transitions/fade.scss

Lines changed: 0 additions & 6 deletions
This file was deleted.

template/src/transitions/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './default'

template/src/transitions/slide-fade.scss

Lines changed: 0 additions & 10 deletions
This file was deleted.

template/src/utils/.gitkeep

Whitespace-only changes.

template/src/vuex/actions.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const plant = function ({ dispatch, state }) {
2+
dispatch('PLANT', 1)
3+
}
4+
5+
export const pullUp = function ({ dispatch, state }) {
6+
dispatch('PULL_UP', 1)
7+
}
8+
9+
export const translate = function ({ dispatch, state }, lang) {
10+
dispatch('TRANSLATE', lang)
11+
}

template/src/vuex/getters.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const getSeed = state => state.seed
2+
export const getLang = state => state.lang

template/src/vuex/store.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import Vue from 'vue'
2+
import Vuex from 'vuex'
3+
4+
import settings from 'lib/settings.js'
5+
6+
// Make vue aware of Vuex
7+
Vue.use(Vuex)
8+
9+
// Create an object to hold the initial state when
10+
// the app starts up
11+
const state = {
12+
seed: settings.seed.default,
13+
lang: settings.lang
14+
}
15+
16+
// Create an object storing various mutations. We will write the mutation
17+
const mutations = {
18+
PLANT (state, amount) {
19+
state.seed = state.seed - amount
20+
},
21+
PULL_UP (state, amount) {
22+
state.seed = state.seed + amount
23+
},
24+
TRANSLATE (state, lang) {
25+
state.lang = lang
26+
}
27+
}
28+
29+
// Combine the initial state and the mutations to create a Vuex store.
30+
// This store can be linked to our app.
31+
export default new Vuex.Store({
32+
state,
33+
mutations
34+
})

0 commit comments

Comments
 (0)