-
Notifications
You must be signed in to change notification settings - Fork 8
/
styleguide.config.js
52 lines (46 loc) · 1.76 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
const path = require('path');
const { camelCase } = require('lodash');
const { createConfig } = require('@webpack-blocks/webpack2');
const babel = require('@webpack-blocks/babel6');
const dir = path.join(__dirname, 'src');
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
const numberComponentPaths = [
`${dir}/components/value/value.jsx`,
`${dir}/components/currency/currency.jsx`,
`${dir}/components/percent/percent.jsx`,
`${dir}/components/development/development.jsx`,
`${dir}/components/updateable/updateable.jsx`,
];
const otherComponentPaths = [`${dir}/components/date-time/date-time.jsx`, `${dir}/components/icon-row/icon-row.jsx`];
module.exports = {
serverPort: 6061, // To not conflict with nordnet-ui-kit
title: 'Nordnet Component Kit',
styleguideDir: path.join(__dirname, 'documentation/dist'),
template: path.resolve(__dirname, './documentation/template.html'),
sections: [
{
name: 'Number Components',
components: () => numberComponentPaths,
content: `${path.resolve(__dirname)}/documentation/number.section.md`,
},
{ name: 'Other Components', components: () => otherComponentPaths },
{
name: 'Higher Order Components',
content: `${path.resolve(__dirname)}/documentation/hoc.section.md`,
},
],
getExampleFilename(componentpath) {
return componentpath.replace(/\.jsx?$/, '.md');
},
getComponentPathLine(componentPath) {
const fileName = path.basename(componentPath, '.jsx');
const componentName = capitalize(camelCase(fileName));
return `import { ${componentName} } from 'nordnet-component-kit';`;
},
styleguideComponents: {
Wrapper: path.join(__dirname, 'documentation', 'wrapper.jsx'),
},
webpackConfig: createConfig([babel()]),
};