-
Notifications
You must be signed in to change notification settings - Fork 56
/
styleguide.config.js
150 lines (148 loc) · 3.96 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
const path = require('path');
const fs = require('fs');
const rdts = require('react-docgen-typescript');
const { version } = require('./package');
const componentRoot = path.join(__dirname, 'docs/components');
const styleguideComponents = {};
const componentFiles = fs.readdirSync(componentRoot);
const env = process.env.NODE_ENV;
for (const componentFile of componentFiles) {
const refName = componentFile.replace('.tsx', '');
styleguideComponents[refName] = path.join(componentRoot, refName);
}
module.exports = {
version,
title: 'Precise UI',
propsParser: rdts.withDefaultConfig().parse,
assetsDir: path.resolve(__dirname, 'docs', 'assets'),
skipComponentsWithoutExample: true,
pagePerSection: true,
compilerConfig: {
transforms: {
dangerousTaggedTemplateString: true,
},
objectAssign: 'Object.assign',
},
ribbon: {
url: 'https://github.com/ZEISS/precise-ui',
text: 'GitHub repository',
},
usageMode: 'expand',
sections: [
{
name: 'Getting Started',
sectionDepth: 0,
content: path.resolve(__dirname, './docs/introduction/index.md'),
sections: [
{
name: 'Installation',
content: path.resolve(__dirname, 'docs/introduction/installation.md'),
},
{
name: 'Usage',
content: path.resolve(__dirname, 'docs/introduction/usage.md'),
},
{
name: 'Available Components',
content: path.resolve(__dirname, 'docs/introduction/components.md'),
},
{
name: 'Support',
content: path.resolve(__dirname, 'docs/introduction/support.md'),
},
],
},
{
name: 'Components',
sectionDepth: 0,
components: path.resolve(__dirname, 'src/components/**/*.tsx'),
},
{
name: 'Styleguide',
sectionDepth: 0,
content: path.resolve(__dirname, './docs/styleguide/index.md'),
sections: [
{
name: 'Colors',
content: path.resolve(__dirname, 'docs/styleguide/colors.md'),
},
{
name: 'Pattern Library',
content: path.resolve(__dirname, 'docs/styleguide/pattern.md'),
},
{
name: 'Types',
content: path.resolve(__dirname, 'docs/styleguide/types.md'),
},
{
name: 'Typography',
content: path.resolve(__dirname, 'docs/styleguide/typography.md'),
},
],
},
{
name: 'Theme',
sectionDepth: 0,
content: path.resolve(__dirname, './docs/theme/index.md'),
sections: [
{
name: 'Colors',
content: path.resolve(__dirname, 'docs/theme/colors.md'),
},
],
},
],
template: {
head: {
links: [
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css?family=Roboto',
},
{
rel: 'stylesheet',
href: '/style.css',
},
],
meta: [
{
name: 'description',
content: 'Precise UI React component library.',
},
],
raw: ['<base href="/" />'],
},
},
styleguideComponents,
getExampleFilename(componentPath) {
const dir = path.dirname(componentPath);
return path.join(dir, `Example.md`);
},
getComponentPathLine(componentPath) {
const dir = path.dirname(componentPath);
const name = path.basename(dir);
return `import { ${name} } from 'precise-ui';`;
},
ignore: [path.resolve(__dirname, 'src/**/*.test.tsx'), path.resolve(__dirname, 'src/**/*.part.tsx')],
theme: {
color: {},
},
styles: {
Logo: {
logo: {
backgroundImage: 'url(logo.svg)',
backgroundRepeat: 'no-repeat',
paddingTop: '85px',
backgroundPosition: 'center 0',
textAlign: 'center',
backgroundSize: '80px 80px',
},
},
Version: {
version: {
textAlign: 'center',
},
},
},
styleguideDir: path.join(__dirname, `${env === 'test' ? 'integration/' : ''}styleguide`),
};