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 --- .storybook/addons.js | 2 ++ .storybook/config.js | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 .storybook/addons.js create mode 100644 .storybook/config.js (limited to '.storybook') diff --git a/.storybook/addons.js b/.storybook/addons.js new file mode 100644 index 0000000..6aed412 --- /dev/null +++ b/.storybook/addons.js @@ -0,0 +1,2 @@ +import '@storybook/addon-actions/register'; +import '@storybook/addon-links/register'; diff --git a/.storybook/config.js b/.storybook/config.js new file mode 100644 index 0000000..7126515 --- /dev/null +++ b/.storybook/config.js @@ -0,0 +1,10 @@ +import { configure } from '@storybook/vue' + +import '../assets/css/main.css' + +const req = require.context('../components', true, /\.stories.js$/) +function loadStories() { + req.keys().forEach(filename => req(filename)) +} + +configure(loadStories, module) -- 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 '.storybook') 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 82cd395bf7deb8f1df95be5a0bb3f59d0b1108e1 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Mon, 21 Oct 2019 20:06:48 +0200 Subject: Add Facebook components --- .storybook/decorators/index.js | 2 +- components/Facebook/FacebookFeed.stories.js | 13 ++++++++ components/Facebook/FacebookFeed.vue | 29 ++++++++++++++++++ .../Facebook/FacebookFindUsButton.stories.js | 13 ++++++++ components/Facebook/FacebookFindUsButton.vue | 35 ++++++++++++++++++++++ components/FacebookFeed.vue | 25 ---------------- components/FacebookFindUsButton.vue | 35 ---------------------- components/PostList/PurePostList.stories.js | 3 -- package.json | 2 +- pages/index.vue | 2 +- 10 files changed, 93 insertions(+), 66 deletions(-) create mode 100644 components/Facebook/FacebookFeed.stories.js create mode 100644 components/Facebook/FacebookFeed.vue create mode 100644 components/Facebook/FacebookFindUsButton.stories.js create mode 100644 components/Facebook/FacebookFindUsButton.vue delete mode 100644 components/FacebookFeed.vue delete mode 100644 components/FacebookFindUsButton.vue (limited to '.storybook') diff --git a/.storybook/decorators/index.js b/.storybook/decorators/index.js index acea431..518f966 100644 --- a/.storybook/decorators/index.js +++ b/.storybook/decorators/index.js @@ -1,6 +1,6 @@ export const center = () => { return { template: - '
' + '
' } } diff --git a/components/Facebook/FacebookFeed.stories.js b/components/Facebook/FacebookFeed.stories.js new file mode 100644 index 0000000..4eced7f --- /dev/null +++ b/components/Facebook/FacebookFeed.stories.js @@ -0,0 +1,13 @@ +import { storiesOf } from '@storybook/vue' +import { center } from '../../.storybook/decorators' + +import FacebookFeed from './FacebookFeed' + +storiesOf('FacebookFeed', module) + .addDecorator(center) + .add('default', () => { + return { + components: { FacebookFeed }, + template: `` + } + }) diff --git a/components/Facebook/FacebookFeed.vue b/components/Facebook/FacebookFeed.vue new file mode 100644 index 0000000..56172f4 --- /dev/null +++ b/components/Facebook/FacebookFeed.vue @@ -0,0 +1,29 @@ + + + + + \ No newline at end of file diff --git a/components/Facebook/FacebookFindUsButton.stories.js b/components/Facebook/FacebookFindUsButton.stories.js new file mode 100644 index 0000000..e76f8f9 --- /dev/null +++ b/components/Facebook/FacebookFindUsButton.stories.js @@ -0,0 +1,13 @@ +import { storiesOf } from '@storybook/vue' +import { center } from '../../.storybook/decorators' + +import FacebookFindUsButton from './FacebookFindUsButton' + +storiesOf('FacebookFindUsButton', module) + .addDecorator(center) + .add('default', () => { + return { + components: { FacebookFindUsButton }, + template: `` + } + }) diff --git a/components/Facebook/FacebookFindUsButton.vue b/components/Facebook/FacebookFindUsButton.vue new file mode 100644 index 0000000..9a27c11 --- /dev/null +++ b/components/Facebook/FacebookFindUsButton.vue @@ -0,0 +1,35 @@ + + + \ No newline at end of file diff --git a/components/FacebookFeed.vue b/components/FacebookFeed.vue deleted file mode 100644 index 9d2d251..0000000 --- a/components/FacebookFeed.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/FacebookFindUsButton.vue b/components/FacebookFindUsButton.vue deleted file mode 100644 index 9a27c11..0000000 --- a/components/FacebookFindUsButton.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - \ No newline at end of file diff --git a/components/PostList/PurePostList.stories.js b/components/PostList/PurePostList.stories.js index cf812f7..00516f8 100644 --- a/components/PostList/PurePostList.stories.js +++ b/components/PostList/PurePostList.stories.js @@ -1,15 +1,12 @@ 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 }, diff --git a/package.json b/package.json index 4c6ff52..63620e0 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "postbuild": "./scripts/postbuild.sh", "start": "nuxt start", "test": "jest", - "storybook": "start-storybook -p 6006", + "storybook": "start-storybook -p 6006 -s static", "build-storybook": "build-storybook" }, "dependencies": { diff --git a/pages/index.vue b/pages/index.vue index 8b093df..12caa0c 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -11,7 +11,7 @@