From 2cd4b12207b7230eceb2e0f07762e138f4126f63 Mon Sep 17 00:00:00 2001 From: esikkala <esko.ikkala@aalto.fi> Date: Thu, 7 May 2020 15:23:13 +0300 Subject: [PATCH] Add an intro page for Storybook --- .storybook/main.js | 1 - .storybook/preview.js | 12 ++++++++++-- .storybook/welcome.stories.js | 26 ++++++++++++++++++++++++++ README.md | 6 ++++-- src/client/index.html | 2 +- 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 .storybook/welcome.stories.js diff --git a/.storybook/main.js b/.storybook/main.js index 1e737d44..2e14c9c0 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,5 +1,4 @@ module.exports = { - stories: ['../src/client/components/**/*.stories.js'], addons: [ '@storybook/addon-docs', ], diff --git a/.storybook/preview.js b/.storybook/preview.js index be0a88b2..325ad742 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,4 +1,4 @@ -import { addDecorator } from '@storybook/react' +import { configure, addDecorator } from '@storybook/react' import React from 'react' import { createStore } from 'redux' import { Provider } from 'react-redux' @@ -11,9 +11,17 @@ import localeEN from '../src/client/translations/sampo/localeEN' import localeFI from '../src/client/translations/sampo/localeFI' import localeSV from '../src/client/translations/sampo/localeSV' import reducer from '../src/client/reducers' - import '../src/client/index.css' +const loaderFn = () => { + const allExports = [require('./welcome.stories.js')]; + const req = require.context('../src/client/components', true, /\.stories\.js$/); + req.keys().forEach(fname => allExports.push(req(fname))); + return allExports; +}; + +configure(loaderFn, module); + const store = createStore(reducer) intl.init({ diff --git a/.storybook/welcome.stories.js b/.storybook/welcome.stories.js new file mode 100644 index 00000000..1f2a983e --- /dev/null +++ b/.storybook/welcome.stories.js @@ -0,0 +1,26 @@ +import React from 'react'; +import TextPage from '../src/client/components/main_layout/TextPage' +import Typography from '@material-ui/core/Typography' + +export default { + title: 'Sampo-UI/introduction' + } + +export const welcome = () => + <TextPage> + <Typography component='h1' variant='h2'>Welcome to Sampo-UI</Typography> + <Typography paragraph> + This Storybook is used for documenting the reusable component library of + the Sampo-UI framework. These components are designed for building user interfaces for semantic portals. + </Typography> + <Typography paragraph> + The source code of Sampo-UI is published on <a target='_blank' href='https://github.com/SemanticComputing/sampo-ui'>GitHub</a>. + The folders in this Storybook reflect the <a target='_blank' href='https://github.com/SemanticComputing/sampo-ui/tree/master/src/client/components'>folders</a> in + the GitHub repository, where the components are split into three categories: + </Typography> + <ul> + <li><Typography>main_layout</Typography></li> + <li><Typography>facet_results</Typography></li> + <li><Typography>perspectives</Typography></li> + </ul> + </TextPage> \ No newline at end of file diff --git a/README.md b/README.md index 256c1148..d8a71163 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,11 @@ A framework for building user interfaces for semantic portals. The following por * [HistorySampo](https://github.com/SemanticComputing/historysampo-web-app) * [ParliamentSampo?] -Sampo-UI framework is being developed by the [Semantic Computing Research Group (SeCo)](https://seco.cs.aalto.fi) at the Aalto University, Finland. +Sampo-UI framework is being developed by the [Semantic Computing Research Group (SeCo)](https://seco.cs.aalto.fi) at the Aalto University, Finland. See the [research page](https://seco.cs.aalto.fi/tools/sampo-ui) for more information. -See the [research page](https://seco.cs.aalto.fi/tools/sampo-ui) for more information. +## Documentation + +Sampo-UI's React components are documented [here](https://semanticcomputing.github.io/sampo-ui) ## Requirements diff --git a/src/client/index.html b/src/client/index.html index 45b631b4..ce3dc83b 100644 --- a/src/client/index.html +++ b/src/client/index.html @@ -6,7 +6,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="" /> <meta name="robots" content="noindex"> - <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"> + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" /> <title>Sampo Semantic Portal</title> </head> -- GitLab