Skip to content

Commit 26f14d7

Browse files
committed
[update] Full Staticモードにする
1 parent 86e7a74 commit 26f14d7

22 files changed

+9134
-12322
lines changed

.eslintrc.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
node: true,
6+
},
7+
parserOptions: {
8+
parser: 'babel-eslint',
9+
},
10+
extends: [
11+
'@nuxtjs',
12+
'prettier',
13+
'prettier/vue',
14+
'plugin:prettier/recommended',
15+
'plugin:nuxt/recommended',
16+
],
17+
plugins: ['prettier'],
18+
// add your custom rules here
19+
rules: {
20+
'vue/no-v-html': 'off',
21+
},
22+
};

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true
4+
}

README.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
# blog
2-
3-
> microCMS blog
1+
# microcms-blog
42

53
## Build Setup
64

7-
``` bash
5+
```bash
86
# install dependencies
9-
$ yarn install
7+
$ npm install
108

119
# serve with hot reload at localhost:3000
12-
$ yarn dev
10+
$ npm run dev
1311

1412
# build for production and launch server
15-
$ yarn build
16-
$ yarn start
13+
$ npm run build
14+
$ npm run start
1715

1816
# generate static project
19-
$ yarn generate
17+
$ npm run generate
2018
```
2119

2220
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org).

components/Breadcrumb.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<nuxt-link to="/">記事一覧</nuxt-link>
55
</li>
66
<li v-if="category !== undefined" class="breadcrumbList">
7-
<nuxt-link v-bind:to="`/category/${category.id}/page/1`">{{
7+
<nuxt-link :to="`/category/${category.id}/page/1`">{{
88
category.name
99
}}</nuxt-link>
1010
</li>
@@ -13,7 +13,13 @@
1313

1414
<script>
1515
export default {
16-
props: ['category']
16+
props: {
17+
category: {
18+
type: Object,
19+
required: false,
20+
default: () => ({}),
21+
},
22+
},
1723
};
1824
</script>
1925

components/Categories.vue

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h1 class="pageTitle">カテゴリー</h1>
44
<ul>
55
<li v-for="category in categories" :key="category.id" class="list">
6-
<nuxt-link v-bind:to="`/category/${category.id}/page/1`" class="link">{{
6+
<nuxt-link :to="`/category/${category.id}/page/1`" class="link">{{
77
category.name
88
}}</nuxt-link>
99
</li>
@@ -12,9 +12,14 @@
1212
</template>
1313

1414
<script>
15-
import axios from 'axios';
1615
export default {
17-
props: ['categories']
16+
props: {
17+
categories: {
18+
type: Array,
19+
required: false,
20+
default: () => [],
21+
},
22+
},
1823
};
1924
</script>
2025

components/Header.vue

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</button>
1212
<div v-if="open" class="mask" @click="setOpen(false)"></div>
1313

14-
<div class="menu" :class="{'isOpen': open}">
14+
<div class="menu" :class="{ isOpen: open }">
1515
<ul class="lists">
1616
<li class="list">
1717
<a href="https://microcms.io/pricing">料金</a>
@@ -31,7 +31,9 @@
3131
<a class="signin" href="https://app.microcms.io/signin">ログイン</a>
3232
</li>
3333
<li class="list">
34-
<a class="signup" v-bind:href="`https://app.microcms.io${params}`">新規登録</a>
34+
<a class="signup" :href="`https://app.microcms.io${params}`"
35+
>新規登録</a
36+
>
3537
</li>
3638
</ul>
3739
</div>
@@ -42,11 +44,10 @@
4244

4345
<script>
4446
export default {
45-
props: ['isWhite'],
4647
data() {
4748
return {
4849
params: this.params || '',
49-
open: false
50+
open: false,
5051
};
5152
},
5253
mounted() {
@@ -58,8 +59,8 @@ export default {
5859
},
5960
toggleOpen() {
6061
this.open = !this.open;
61-
}
62-
}
62+
},
63+
},
6364
};
6465
</script>
6566

components/Latest.vue

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
<h1 class="pageTitle">最新の記事</h1>
44
<ul>
55
<li v-for="content in contents" :key="content.id" class="list">
6-
<nuxt-link v-bind:to="`/${content.id}`" class="link">
6+
<nuxt-link :to="`/${content.id}`" class="link">
77
<dl class="content">
88
<dt class="title">{{ content.title }}</dt>
9-
<dd>
10-
<Meta :createdAt="content.createdAt" :author="content.author" />
11-
</dd>
129
</dl>
1310
</nuxt-link>
1411
</li>
@@ -17,9 +14,14 @@
1714
</template>
1815

1916
<script>
20-
import axios from 'axios';
2117
export default {
22-
props: ['contents']
18+
props: {
19+
contents: {
20+
type: Array,
21+
required: false,
22+
default: () => [],
23+
},
24+
},
2325
};
2426
</script>
2527

components/Logo.vue

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<template>
2+
<svg
3+
class="NuxtLogo"
4+
width="245"
5+
height="180"
6+
viewBox="0 0 452 342"
7+
xmlns="http://www.w3.org/2000/svg"
8+
>
9+
<path
10+
d="M139 330l-1-2c-2-4-2-8-1-13H29L189 31l67 121 22-16-67-121c-1-2-9-14-22-14-6 0-15 2-22 15L5 303c-1 3-8 16-2 27 4 6 10 12 24 12h136c-14 0-21-6-24-12z"
11+
fill="#00C58E"
12+
/>
13+
<path
14+
d="M447 304L317 70c-2-2-9-15-22-15-6 0-15 3-22 15l-17 28v54l39-67 129 230h-49a23 23 0 0 1-2 14l-1 1c-6 11-21 12-23 12h76c3 0 17-1 24-12 3-5 5-14-2-26z"
15+
fill="#108775"
16+
/>
17+
<path
18+
d="M376 330v-1l1-2c1-4 2-8 1-12l-4-12-102-178-15-27h-1l-15 27-102 178-4 12a24 24 0 0 0 2 15c4 6 10 12 24 12h190c3 0 18-1 25-12zM256 152l93 163H163l93-163z"
19+
fill="#2F495E"
20+
/>
21+
</svg>
22+
</template>
23+
24+
<style>
25+
.NuxtLogo {
26+
animation: 1s appear;
27+
margin: auto;
28+
}
29+
30+
@keyframes appear {
31+
0% {
32+
opacity: 0;
33+
}
34+
}
35+
</style>

components/Meta.vue

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<span class="category" v-if="category">{{ category.name }}</span>
3+
<span v-if="category" class="category">{{ category.name }}</span>
44
<div class="meta">
55
<span class="timestamp">
66
<img src="/blog/images/icon_clock.svg" alt />
@@ -16,7 +16,22 @@
1616

1717
<script>
1818
export default {
19-
props: ['createdAt', 'author', 'category']
19+
props: {
20+
createdAt: {
21+
type: String,
22+
required: true,
23+
},
24+
author: {
25+
type: String,
26+
required: false,
27+
default: undefined,
28+
},
29+
category: {
30+
type: Object,
31+
required: false,
32+
default: undefined,
33+
},
34+
},
2035
};
2136
</script>
2237

components/Post.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44

55
<script>
66
export default {
7-
props: ['body']
7+
props: {
8+
body: {
9+
type: String,
10+
required: true,
11+
default: '',
12+
},
13+
},
814
};
915
</script>
1016

components/RelatedBlogs.vue

+11-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<h2 class="pageTitle">関連記事</h2>
44
<ul class="lists">
55
<li v-for="blog in blogs" :key="blog.id" class="list">
6-
<nuxt-link v-bind:to="`/${blog.id}`" class="link">
6+
<nuxt-link :to="`/${blog.id}`" class="link">
77
<picture>
88
<source
99
type="image/webp"
@@ -15,7 +15,7 @@
1515
<dt class="title">{{ blog.title }}</dt>
1616
<dd>
1717
<Meta
18-
:createdAt="blog.createdAt"
18+
:created-at="blog.createdAt"
1919
:author="blog.writer.name"
2020
:category="blog.category"
2121
/>
@@ -28,13 +28,18 @@
2828
</template>
2929

3030
<script>
31-
import axios from 'axios';
3231
import Meta from '~/components/Meta.vue';
3332
export default {
34-
props: ['blogs'],
3533
components: {
36-
Meta
37-
}
34+
Meta,
35+
},
36+
props: {
37+
blogs: {
38+
type: Array,
39+
required: false,
40+
default: () => [],
41+
},
42+
},
3843
};
3944
</script>
4045

components/Toc.vue

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div v-if="visible" class="wrapper">
33
<h4 class="title">目次</h4>
44
<ul class="lists">
5-
<li :class="`list ${item.name}`" v-for="item in toc" :key="item.id">
5+
<li v-for="item in toc" :key="item.id" :class="`list ${item.name}`">
66
<n-link v-scroll-to="`#${item.id}`" to>
77
{{ item.text }}
88
</n-link>
@@ -13,7 +13,18 @@
1313

1414
<script>
1515
export default {
16-
props: ['toc', 'id', 'visible']
16+
props: {
17+
toc: {
18+
type: Array,
19+
required: true,
20+
default: () => [],
21+
},
22+
visible: {
23+
type: Boolean,
24+
required: false,
25+
default: false,
26+
},
27+
},
1728
};
1829
</script>
1930

components/Writer.vue

+18-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22
<div class="wrapper">
33
<h2 class="title">ABOUT ME</h2>
44
<div class="container">
5-
<img :src="writer.image.url + '?fit=crop&w=100&h=100&q=100'" class="image" alt />
5+
<img
6+
:src="writer.image.url + '?fit=crop&w=100&h=100&q=100'"
7+
class="image"
8+
alt
9+
/>
610
<dl class="content">
711
<dt class="name">
812
{{ writer.name }}
9-
<a class="twitterLink" v-bind:href="`https://twitter.com/${writer.id}`">
10-
<img class="twitter" src="/blog/images/icon_twitter.svg" alt="Twitter" />
13+
<a class="twitterLink" :href="`https://twitter.com/${writer.id}`">
14+
<img
15+
class="twitter"
16+
src="/blog/images/icon_twitter.svg"
17+
alt="Twitter"
18+
/>
1119
</a>
1220
</dt>
1321
<dd class="text">{{ writer.text }}</dd>
@@ -18,7 +26,13 @@
1826

1927
<script>
2028
export default {
21-
props: ['writer']
29+
props: {
30+
writer: {
31+
type: Object,
32+
required: true,
33+
default: () => ({}),
34+
},
35+
},
2236
};
2337
</script>
2438

0 commit comments

Comments
 (0)