forked from vrk-kpa/suomifi-ui-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyleguide.config.js
68 lines (65 loc) · 2.13 KB
/
styleguide.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const path = require('path');
const packagejson = require('./package.json');
// Filter props from styleguidist that don't have description in interface or are from react typings
const propFilter = (prop) => {
if (prop.description.length === 0) {
return false;
}
if (prop.parent == null) {
return true;
}
return prop.parent.fileName.indexOf('node_modules/@types/react') < 0;
};
const requireFiles = (axe) => [
...(!!axe
? [path.join(__dirname, '.styleguidist/styleguidist.require.axe.js')]
: []),
path.join(__dirname, '.styleguidist/styleguidist.require.js'),
];
module.exports = {
title: `Suomifi-ui-components ${packagejson.version}`,
components: 'src/core/**/[A-Z]*.tsx',
ignore: ['**/*basestyles.tsx', '**/*baseStyles.tsx', '**/*test.tsx'],
webpackConfig: require('./.styleguidist/webpack.config.js'),
require: requireFiles(!!process.env.AXE),
assetsDir: path.join(__dirname, '.styleguidist/assets'),
resolver: require('react-docgen').resolver.findAllComponentDefinitions,
propsParser: require('react-docgen-typescript').withDefaultConfig({
propFilter,
}).parse,
moduleAliases: {
'suomifi-ui-components': path.resolve(__dirname, 'src'),
'rsg-components/ComponentsList/ComponentsListRenderer': path.resolve(
__dirname,
'node_modules/react-styleguidist/lib/client/rsg-components/ComponentsList/ComponentsListRenderer',
),
},
exampleMode: 'expand',
usageMode: 'expand',
pagePerSection: true,
tocMode: 'collapse',
skipComponentsWithoutExample: true,
getExampleFilename: (componentPath) =>
componentPath.replace(/\.tsx?$/, '.md'),
template: {
head: {
links: [
{
rel: 'stylesheet',
href:
'https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600&display=swap',
},
],
},
},
theme: {
fontFamily: {
base: '"Source Sans Pro", sans-serif',
},
},
styles: require('./.styleguidist/styleguidist.styles.js'),
sections: require('./.styleguidist/styleguidist.sections.js').sections,
styleguideComponents: {
ComponentsList: path.join(__dirname, '.styleguidist/ComponentsList'),
},
};