cleaned, switched from stylus to sass
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
.full-width{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.center-content{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
*:focus{
|
||||||
|
outline: 1px dotted red;
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
.full-width
|
|
||||||
width 100%
|
|
||||||
|
|
||||||
.center-content
|
|
||||||
display flex
|
|
||||||
justify-content center
|
|
||||||
align-items center
|
|
||||||
|
|
||||||
*:focus
|
|
||||||
outline: 1px dotted red;
|
|
||||||
@@ -4,7 +4,7 @@ const webpack = require('webpack')
|
|||||||
const merge = require('webpack-merge')
|
const merge = require('webpack-merge')
|
||||||
const baseConfig = require('./webpack.config.base')
|
const baseConfig = require('./webpack.config.base')
|
||||||
|
|
||||||
const PORT = 8080
|
const PORT = 8988
|
||||||
|
|
||||||
module.exports = merge(baseConfig, {
|
module.exports = merge(baseConfig, {
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
@@ -31,11 +31,11 @@ module.exports = merge(baseConfig, {
|
|||||||
'css-loader'
|
'css-loader'
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
test: /\.styl(us)?$/,
|
test: /\.scss$/,
|
||||||
use: [
|
use: [
|
||||||
'vue-style-loader',
|
'vue-style-loader',
|
||||||
'css-loader',
|
'css-loader',
|
||||||
'stylus-loader'
|
'sass-loader'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ module.exports = merge(baseConfig, {
|
|||||||
{
|
{
|
||||||
test: /\.css?$/,
|
test: /\.css?$/,
|
||||||
use: [
|
use: [
|
||||||
MiniCssExtractPlugin.loader,
|
MiniCssExtractPlugin.loader,
|
||||||
'css-loader'
|
'css-loader'
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
test: /\.styl(us)?$/,
|
test: /\.scss$/,
|
||||||
use: [
|
use: [
|
||||||
MiniCssExtractPlugin.loader,
|
MiniCssExtractPlugin.loader,
|
||||||
'css-loader',
|
'css-loader',
|
||||||
'stylus-loader'
|
'sass-loader'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Generated
+814
-1
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,8 @@
|
|||||||
"jest": "^24.5.0",
|
"jest": "^24.5.0",
|
||||||
"jest-serializer-vue": "^2.0.2",
|
"jest-serializer-vue": "^2.0.2",
|
||||||
"mini-css-extract-plugin": "^0.5.0",
|
"mini-css-extract-plugin": "^0.5.0",
|
||||||
|
"node-sass": "^4.12.0",
|
||||||
|
"sass-loader": "^7.1.0",
|
||||||
"style-loader": "^0.23.1",
|
"style-loader": "^0.23.1",
|
||||||
"stylus": "^0.54.5",
|
"stylus": "^0.54.5",
|
||||||
"stylus-loader": "^3.0.2",
|
"stylus-loader": "^3.0.2",
|
||||||
|
|||||||
+12
-13
@@ -3,11 +3,10 @@
|
|||||||
<header role="banner">
|
<header role="banner">
|
||||||
<h1
|
<h1
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@click="closePost()"
|
|
||||||
@keydown.enter="closePost()"
|
|
||||||
>
|
>
|
||||||
Les Guides de Paris
|
Les Guides de Paris
|
||||||
</h1>
|
</h1>
|
||||||
|
<HeaderMenu />
|
||||||
</header>
|
</header>
|
||||||
<section class="container center-content">
|
<section class="container center-content">
|
||||||
<RouterView />
|
<RouterView />
|
||||||
@@ -17,7 +16,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapActions } from 'vuex'
|
import HeaderMenu from './components/nav/HeaderMenu'
|
||||||
|
// import { mapState, mapActions } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
metaInfo: {
|
metaInfo: {
|
||||||
@@ -26,19 +26,18 @@ export default {
|
|||||||
// all titles will be injected into this template
|
// all titles will be injected into this template
|
||||||
titleTemplate: '%s | Guides de Paris'
|
titleTemplate: '%s | Guides de Paris'
|
||||||
},
|
},
|
||||||
computed: mapState({
|
components: {
|
||||||
opened: state => state.posts.opened
|
HeaderMenu
|
||||||
}),
|
}
|
||||||
methods: mapActions('posts', [
|
|
||||||
'closePost'
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.container
|
.container{
|
||||||
font-family 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif
|
font-family:'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
|
||||||
max-width 1200px
|
max-width: 1200px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
import { HTTP } from './http-axios'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
getPosts (cb) {
|
|
||||||
HTTP.get('posts')
|
|
||||||
.then(response => {
|
|
||||||
console.log('response', response)
|
|
||||||
cb(response.data)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getPost (id, cb) {
|
|
||||||
HTTP.get(`posts/` + id)
|
|
||||||
.then(response => {
|
|
||||||
console.log('response', response)
|
|
||||||
cb(response.data)
|
|
||||||
})
|
|
||||||
.catch(e => {
|
|
||||||
this.errors.push(e)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<template>
|
|
||||||
<section v-if="opened != null">
|
|
||||||
<h2>{{ opened.title }}</h2>
|
|
||||||
<p>{{ opened.body }}</p>
|
|
||||||
<a
|
|
||||||
href="#"
|
|
||||||
@click="closePost()"
|
|
||||||
@keydown.enter="closePost()"
|
|
||||||
>
|
|
||||||
close
|
|
||||||
</a>
|
|
||||||
</section>
|
|
||||||
<ul v-else>
|
|
||||||
<li
|
|
||||||
v-for="post in posts"
|
|
||||||
:key="post.id"
|
|
||||||
>
|
|
||||||
<h2>
|
|
||||||
<a
|
|
||||||
:href="'#post-'+post.id"
|
|
||||||
@click="openPost(post)"
|
|
||||||
@keydown.enter="openPost(post)"
|
|
||||||
>
|
|
||||||
{{ post.title }}
|
|
||||||
</a>
|
|
||||||
</h2>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { mapState, mapActions } from 'vuex'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
computed: mapState({
|
|
||||||
opened: state => state.posts.opened,
|
|
||||||
posts: state => state.posts.all
|
|
||||||
}),
|
|
||||||
created () {
|
|
||||||
this.$store.dispatch('posts/getAllPosts')
|
|
||||||
},
|
|
||||||
methods: mapActions('posts', [
|
|
||||||
'openPost',
|
|
||||||
'closePost'
|
|
||||||
]),
|
|
||||||
metaInfo () {
|
|
||||||
return {
|
|
||||||
title: this.opened !== null ? this.opened.title : 'home'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<nav id="">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#">Index</a></li>
|
||||||
|
<li><a href="#">Bibliographie</a></li>
|
||||||
|
<li><a href="#">Blog</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'HeaderMenu',
|
||||||
|
data: () => ({
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
||||||
+1
-1
@@ -3,7 +3,7 @@ import router from './router'
|
|||||||
import store from './store'
|
import store from './store'
|
||||||
import Meta from 'vue-meta'
|
import Meta from 'vue-meta'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import 'assets/css/app.styl'
|
import 'assets/css/app.scss'
|
||||||
|
|
||||||
Vue.use(Meta)
|
Vue.use(Meta)
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -1,15 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="full-width">
|
<div class="full-width">
|
||||||
<Posts />
|
<h2>Home</h2>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Posts from 'components/Home/Posts'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
|
||||||
Posts
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Vue.use(Router)
|
|||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
|
name: 'home',
|
||||||
path: '*',
|
path: '*',
|
||||||
component: Home
|
component: Home
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -1,12 +1,11 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import posts from './modules/posts'
|
|
||||||
|
|
||||||
// https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart
|
// https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
posts
|
// search
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
import datarest from '../../api/datarest'
|
|
||||||
|
|
||||||
// initial state
|
|
||||||
const state = {
|
|
||||||
all: [],
|
|
||||||
opened: null
|
|
||||||
}
|
|
||||||
|
|
||||||
// getters
|
|
||||||
const getters = {}
|
|
||||||
|
|
||||||
// actions
|
|
||||||
const actions = {
|
|
||||||
getAllPosts ({ commit }) {
|
|
||||||
datarest.getPosts(posts => {
|
|
||||||
commit('setPosts', posts)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
openPost ({ commit }, post) {
|
|
||||||
datarest.getPost(post.id, post => {
|
|
||||||
commit('setOpened', post)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
closePost ({ commit }) {
|
|
||||||
commit('clearOpened')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// mutations
|
|
||||||
const mutations = {
|
|
||||||
setPosts (state, posts) {
|
|
||||||
state.all = posts
|
|
||||||
},
|
|
||||||
setOpened (state, post) {
|
|
||||||
state.opened = post
|
|
||||||
},
|
|
||||||
clearOpened (state) {
|
|
||||||
state.opened = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state,
|
|
||||||
getters,
|
|
||||||
actions,
|
|
||||||
mutations
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user