-
Notifications
You must be signed in to change notification settings - Fork 86
/
styleguide.config.js
132 lines (120 loc) · 3.54 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
const path = require('path');
const docgen = require('react-docgen-typescript');
const { name: title, version } = require('./package.json');
const componentsGlob = 'src/**/[A-Z]*.{js,jsx,ts,tsx}';
module.exports = {
title,
version,
styleguideDir: 'styleguide',
components: componentsGlob,
moduleAliases: {
[title]: path.resolve(__dirname, 'src'),
},
propsParser: docgen.withCustomConfig('./tsconfig.json', {
savePropValueAsString: true,
}).parse,
webpackConfig: {
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'ts-loader',
},
],
},
},
theme: {
sidebarWidth: '20em',
},
styles: (theme) => ({
// somehow the <th> cells for tables didn't get the expected styleguide
// theming,so we force the same font information into the body
StyleGuide: {
'@global body': { fontFamily: theme.fontFamily.base },
},
// Similarly, table cells looks like they're styled to vertical-align: top,
// but it doesn't actually happen unless we force the issue!
Table: {
cellHeading: {
textAlign: 'left',
paddingBottom: theme.space[1],
paddingRight: theme.space[2],
fontWeight: 'bold',
},
cell: {
verticalAlign: 'top',
borderTop: [[1, theme.color.border, 'solid']],
paddingTop: theme.space[1],
paddingBottom: theme.space[1],
paddingRight: theme.space[2],
'&:last-child': {
verticalAlign: 'top',
borderTop: [[1, theme.color.border, 'solid']],
paddingTop: theme.space[1],
paddingBottom: theme.space[1],
paddingRight: 0,
},
'& p:last-child': {
marginBottom: 0,
},
},
},
// Why does styleguidist make these smaller by default?
Name: {
name: {
fontSize: theme.fontSize.text, // not base?
},
},
Type: {
type: {
fontSize: theme.fontSize.text, // not base?
},
},
}),
pagePerSection: true,
sections: [
{
name: 'Simple usage',
description:
'For the easiest usage, the `Crossword` component is a simple drop-in component that provides a basic layout and the vast majority of the functionality.',
components: 'src/Crossword.tsx',
// usageMode: 'expand',
// exampleMode: 'expand',
},
{
name: 'Configuration and customization',
sections: [
{ name: 'Clue input format', content: 'docs/ClueInputFormat.md' },
{ name: 'IPUZ support', content: 'docs/IPUZ.md' },
{ name: 'Styling and theming', content: 'docs/Styling.md' },
],
},
{
name: 'Complex layouts',
description:
'For more-complex layouts, use the `CrosswordProvider` to drive the crossword logic, and `CrosswordGrid` and `DirectionClues` to render the UI as desired.',
components: [
'src/CrosswordProvider.tsx',
'src/CrosswordGrid.tsx',
'src/DirectionClues.tsx',
],
},
{
name: 'All other components',
description:
'You should not typically need to use these components; they are documented here for completeness.',
components: componentsGlob,
ignore:
'src/{Crossword,CrosswordProvider,CrosswordGrid,DirectionClues}.tsx',
},
{
name: 'Installable package (npm)',
href: 'https://www.npmjs.com/package/@jaredreisinger/react-crossword',
},
{
name: 'Source code (GitHub)',
href: 'https://github.com/JaredReisinger/react-crossword',
},
],
};