forked from mavenlink/design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyleguide.config.js
More file actions
152 lines (150 loc) · 4.65 KB
/
styleguide.config.js
File metadata and controls
152 lines (150 loc) · 4.65 KB
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
151
152
/* eslint-disable import/no-commonjs */
const fs = require('fs');
const path = require('path');
const webpackConfig = require('./styleguide/webpack.config.js');
module.exports = {
assetsDir: path.join(__dirname, 'styleguide/assets'),
exampleMode: 'expand',
getExampleFilename(componentPath) {
// Override the default function for finding example files. The default has some unfortunate
// interplay between the presence of an index.js and a FolderName.md file. It thinks that the
// FolderName.md file is intended to coincide with the index.js, instead of FolderName.js.
// Because of that, it picks up examples where it shouldn't be.
// @see https://github.com/styleguidist/react-styleguidist/blob/34f3c83e769542157c72d0e055ad8850d22b6001/src/scripts/schemas/config.js#L97
// @see https://github.com/styleguidist/react-styleguidist/commit/545b466c4461021ac7220504b8d61b4bb62573c2
return componentPath.replace(/\.jsx?$/, '.md');
},
moduleAliases: {
'@mavenlink/design-system': __dirname,
},
pagePerSection: true,
require: [
path.join(__dirname, 'styleguide/content/content.css'),
],
sections: [
{
name: 'Overview',
content: path.join(__dirname, 'styleguide/content/overview/overview.md'),
},
{
name: 'Components',
components: './src/components/**/*.jsx',
sectionDepth: 2,
},
{
name: 'Hooks',
components: './src/hooks/**/*.jsx',
sectionDepth: 1,
},
{
name: 'Icon Library',
content: './styleguide/content/icons/index.md',
},
{
name: 'Guidelines',
sections: [
{
name: 'Accessibility',
content: path.join(__dirname, 'styleguide/content/guidelines/accessibility.md'),
},
{
name: 'Contribute',
content: path.join(__dirname, 'docs/contributing.md'),
},
],
},
{
name: 'Brand Identity',
sections: [
{
name: 'Colors',
content: path.join(__dirname, 'styleguide/content/brand-identity/colors.md'),
},
{
name: 'Spacing',
content: path.join(__dirname, 'styleguide/content/brand-identity/spacing.md'),
},
{
name: 'Typography',
content: path.join(__dirname, 'styleguide/content/brand-identity/typography.md'),
},
],
sectionDepth: 2,
pagePerSection: true,
},
{
name: 'Design Patterns',
sections: [
{
name: 'Basic Page Patterns',
content: path.join(__dirname, 'styleguide/content/design-patterns/basic-page-spacing.md'),
},
],
},
],
skipComponentsWithoutExample: true,
styleguideComponents: {
ComponentsListRenderer: path.join(__dirname, 'styleguide/components/components-list'),
LinkRenderer: path.join(__dirname, 'styleguide/components/link'),
PlaygroundRenderer: path.join(__dirname, 'styleguide/components/playground'),
ReactComponentRenderer: path.join(__dirname, 'styleguide/components/react-component'),
StyleGuideRenderer: path.join(__dirname, 'styleguide/components/styleguide'),
SectionRenderer: path.join(__dirname, './styleguide/components/section'),
TabButton: path.join(__dirname, 'styleguide/components/tab-button'),
TableRenderer: path.join(__dirname, 'styleguide/components/table'),
},
styleguideDir: 'build',
styles: {
Para: {
para: {
fontSize: 14,
},
},
},
template: {
favicon: 'favicon.ico',
head: {
links: [
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css?family=Merriweather|Open+Sans',
},
],
},
},
theme: {
color: {
sidebarBackground: 'white',
},
fontFamily: {
base: '"Open Sans", system-ui, sans-serif', // --mds-type-font-family
},
fontSize: {
base: 14, // --mds-type-content
text: 14, // --mds-type-content
small: 12, // --mds-type-subtext
h1: 22, // --mds-type-page-title
h2: 16, // --mds-type-subhead-1
h3: 16, // --mds-type-subhead-2
h4: 14, // --mds-type-subhead-3
h5: 14, // --mds-type-subhead-3
h6: 14, // --mds-type-subhead-3
},
},
title: 'Mavenlink Design System',
usageMode: 'expand',
updateExample(props = {}, exampleFilePath) {
const { settings = {}, lang } = props;
if (lang === 'css' && typeof settings.file === 'string') {
const filepath = path.resolve(path.dirname(exampleFilePath), settings.file);
settings.static = true;
return {
content: `/* ${settings.file} */\n\n${fs.readFileSync(filepath, 'utf8')}`,
settings,
lang
};
}
return props;
},
webpackConfig,
};