From 424eaa9e8098cef762b1a2a7565d37944bb25306 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Mon, 21 Oct 2019 18:25:12 +0200 Subject: Add storybook --- pages/kronika/index.vue | 8 -------- 1 file changed, 8 deletions(-) (limited to 'pages/kronika') diff --git a/pages/kronika/index.vue b/pages/kronika/index.vue index 4a89a48..cff3551 100644 --- a/pages/kronika/index.vue +++ b/pages/kronika/index.vue @@ -42,11 +42,3 @@ export default { } - \ No newline at end of file -- cgit 1.4.1 From 17fc6a6b4507e5535d8b6989b66da5bac323e87b Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Mon, 21 Oct 2019 19:53:02 +0200 Subject: Add PostList --- .gitignore | 1 + .storybook/decorators/index.js | 6 +++ assets/css/main.css | 3 ++ components/PostLink.stories.js | 8 +-- components/PostLink.vue | 1 + components/PostList/PostList.vue | 49 +++++++++++++++++++ components/PostList/PurePostList.stories.js | 31 ++++++++++++ components/PostList/PurePostList.vue | 76 +++++++++++++++++++++++++++++ components/PostList/index.js | 3 ++ components/PurePostList.stories.js | 16 ------ components/PurePostList.vue | 38 --------------- pages/index.vue | 19 +++++--- pages/kronika/index.vue | 33 ++----------- 13 files changed, 186 insertions(+), 98 deletions(-) create mode 100644 .storybook/decorators/index.js create mode 100644 components/PostList/PostList.vue create mode 100644 components/PostList/PurePostList.stories.js create mode 100644 components/PostList/PurePostList.vue create mode 100644 components/PostList/index.js delete mode 100644 components/PurePostList.stories.js delete mode 100644 components/PurePostList.vue (limited to 'pages/kronika') diff --git a/.gitignore b/.gitignore index 53c3292..6937f9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ content +static/api # Created by .ignore support plugin (hsz.mobi) ### Node template diff --git a/.storybook/decorators/index.js b/.storybook/decorators/index.js new file mode 100644 index 0000000..acea431 --- /dev/null +++ b/.storybook/decorators/index.js @@ -0,0 +1,6 @@ +export const center = () => { + return { + template: + '
' + } +} diff --git a/assets/css/main.css b/assets/css/main.css index 21bcffb..7da562e 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -8,6 +8,9 @@ body { * { box-sizing: border-box; +} + +body { font-family: 'Roboto Slab', serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/components/PostLink.stories.js b/components/PostLink.stories.js index 71d04ed..a824b35 100644 --- a/components/PostLink.stories.js +++ b/components/PostLink.stories.js @@ -1,4 +1,5 @@ import { storiesOf } from '@storybook/vue' +import { center } from '../.storybook/decorators' import PostLink from './PostLink' @@ -9,13 +10,6 @@ export const postLink = { route: '/kronika/2019/20/11/test' } -const center = () => { - return { - template: - '
' - } -} - storiesOf('PostLink', module) .addDecorator(center) .add('default', () => { diff --git a/components/PostLink.vue b/components/PostLink.vue index b0aeb5a..5bc5127 100644 --- a/components/PostLink.vue +++ b/components/PostLink.vue @@ -40,6 +40,7 @@ export default { margin: 20px; flex-basis: 410px; max-width: 410px; + height: 250px; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25); background: #ffffff; text-align: left; diff --git a/components/PostList/PostList.vue b/components/PostList/PostList.vue new file mode 100644 index 0000000..206a73f --- /dev/null +++ b/components/PostList/PostList.vue @@ -0,0 +1,49 @@ + + + \ No newline at end of file diff --git a/components/PostList/PurePostList.stories.js b/components/PostList/PurePostList.stories.js new file mode 100644 index 0000000..cf812f7 --- /dev/null +++ b/components/PostList/PurePostList.stories.js @@ -0,0 +1,31 @@ +import { storiesOf } from '@storybook/vue' +import { center } from '../../.storybook/decorators' + +import { postLink } from '../PostLink.stories' + +import PurePostList from './PurePostList' + +export const posts = Array(5).fill(postLink) +console.log(posts) + +storiesOf('PurePostList', module) + .addDecorator(center) + .add('default', () => { + return { + components: { PurePostList }, + template: ``, + data: () => ({ posts }) + } + }) + .add('loading', () => { + return { + components: { PurePostList }, + template: `` + } + }) + .add('no posts', () => { + return { + components: { PurePostList }, + template: `` + } + }) diff --git a/components/PostList/PurePostList.vue b/components/PostList/PurePostList.vue new file mode 100644 index 0000000..7e70db8 --- /dev/null +++ b/components/PostList/PurePostList.vue @@ -0,0 +1,76 @@ + + + + + \ No newline at end of file diff --git a/components/PostList/index.js b/components/PostList/index.js new file mode 100644 index 0000000..dbb515e --- /dev/null +++ b/components/PostList/index.js @@ -0,0 +1,3 @@ +import PostList from './PostList' + +export default PostList diff --git a/components/PurePostList.stories.js b/components/PurePostList.stories.js deleted file mode 100644 index 134cd68..0000000 --- a/components/PurePostList.stories.js +++ /dev/null @@ -1,16 +0,0 @@ -import { storiesOf } from '@storybook/vue' - -import { postLink } from './PostLink.stories' - -import PurePostList from './PurePostList' - -export const posts = Array(5).fill(postLink) -console.log(posts) - -storiesOf('PurePostList', module).add('default', () => { - return { - components: { PurePostList }, - template: ``, - data: () => ({ posts }) - } -}) diff --git a/components/PurePostList.vue b/components/PurePostList.vue deleted file mode 100644 index a93360d..0000000 --- a/components/PurePostList.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index 736e7f4..8b093df 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,16 +1,21 @@ \ No newline at end of file diff --git a/pages/kronika/index.vue b/pages/kronika/index.vue index cff3551..d9685c1 100644 --- a/pages/kronika/index.vue +++ b/pages/kronika/index.vue @@ -1,43 +1,16 @@ -- cgit 1.4.1 From 070b7725be5fb0db486e9370bea5648c16c8bbfe Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Sat, 30 Nov 2019 13:12:30 +0100 Subject: Fix posts listing --- .gitignore | 1 + pages/kronika/index.vue | 20 ++++++++++---------- scripts/generateApi.js | 5 +++++ scripts/postbuild.sh | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) (limited to 'pages/kronika') diff --git a/.gitignore b/.gitignore index 53c3292..02a490c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ content +static/api/posts.json # Created by .ignore support plugin (hsz.mobi) ### Node template diff --git a/pages/kronika/index.vue b/pages/kronika/index.vue index 4a89a48..d28c2ca 100644 --- a/pages/kronika/index.vue +++ b/pages/kronika/index.vue @@ -1,7 +1,7 @@ +``` + +Or by using the mixin + +```html + + + +``` diff --git a/components/Posts/PostList/index.js b/components/Posts/PostList/index.js index dbb515e..11d44ff 100644 --- a/components/Posts/PostList/index.js +++ b/components/Posts/PostList/index.js @@ -1,3 +1,22 @@ +import axios from 'axios' + +import k from '~/api' import PostList from './PostList' +export const getPosts = async () => { + if (process.client) { + let posts = await axios.get(`${window.location.origin}/api/posts.json`) + return parsePosts(posts.data) + } else { + return parsePosts(k.getPosts()) + } +} + +export const parsePosts = posts => + posts.map(post => ({ + title: post.content.meta.title, + description: post.content.description, + route: post.route + })) + export default PostList diff --git a/components/Posts/PostList/parentMixin.js b/components/Posts/PostList/parentMixin.js new file mode 100644 index 0000000..e5b06ed --- /dev/null +++ b/components/Posts/PostList/parentMixin.js @@ -0,0 +1,9 @@ +import { getPosts } from './index' + +export default { + async asyncData() { + return { + posts: await getPosts() + } + } +} diff --git a/package-lock.json b/package-lock.json index dc75e41..3c259df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4150,7 +4150,7 @@ "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", "requires": { "follow-redirects": "1.5.10", - "is-buffer": "2.0.3" + "is-buffer": "2.0.4" }, "dependencies": { "debug": { @@ -4170,9 +4170,9 @@ } }, "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" }, "ms": { "version": "2.0.0", diff --git a/package.json b/package.json index d7925a2..6522e9d 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "dependencies": { "@nuxtjs/axios": "^5.3.6", "@nuxtjs/pwa": "^3.0.0-0", + "axios": "^0.19.0", "esm": "^3.2.25", "front-matter": "^3.0.2", "jsdom": "^15.1.1", diff --git a/pages/index.vue b/pages/index.vue index 3a19237..045025d 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -3,7 +3,7 @@

Ostatnie wpisy z kroniki

- +
@@ -13,9 +13,11 @@ import JoinUs from '~/components/JoinUs.vue' import FacebookFeed from '~/components/Facebook/FacebookFeed.vue' import PostList from '~/components/Posts/PostList' +import postListParentMixin from '~/components/Posts/PostList/parentMixin' export default { name: 'HomeView', - components: { JoinUs, FacebookFeed, PostList } + components: { JoinUs, FacebookFeed, PostList }, + mixins: [postListParentMixin] } diff --git a/pages/kronika/index.vue b/pages/kronika/index.vue index 86344c3..8142a6c 100644 --- a/pages/kronika/index.vue +++ b/pages/kronika/index.vue @@ -1,16 +1,18 @@ -- cgit 1.4.1 From e84e4a2eb8985b517b706d1735a744b4e9b81518 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Thu, 5 Dec 2019 18:14:53 +0100 Subject: Fix article title on mobile --- pages/kronika/_year/_month/_day/_title/index.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pages/kronika') diff --git a/pages/kronika/_year/_month/_day/_title/index.vue b/pages/kronika/_year/_month/_day/_title/index.vue index dafa237..9fab1d0 100644 --- a/pages/kronika/_year/_month/_day/_title/index.vue +++ b/pages/kronika/_year/_month/_day/_title/index.vue @@ -71,6 +71,12 @@ export default { width: 100%; border-radius: 5px; } + +.article h1 { + font-size: 1.5em; + letter-spacing: 0; +} + @media (max-width: 720px) { .article { padding: 60px 20px; @@ -78,5 +84,9 @@ export default { .article p { text-align: justify; } + .article h1 { + font-size: 1.7em; + font-weight: 700; + } } -- cgit 1.4.1