-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathpreview.js
164 lines (159 loc) · 3.46 KB
/
preview.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**
* External dependencies
*/
import {
Controls,
Description,
Primary,
Stories,
Subtitle,
Title,
} from '@storybook/blocks';
/**
* Internal dependencies
*/
import { WithGlobalCSS } from './decorators/with-global-css';
import { WithMarginChecker } from './decorators/with-margin-checker';
import { WithMaxWidthWrapper } from './decorators/with-max-width-wrapper';
import { WithRTL } from './decorators/with-rtl';
import { WithTheme } from './decorators/with-theme';
import badgesConfig from './badges';
export const globalTypes = {
direction: {
name: 'RTL',
description: 'Simulate an RTL language.',
defaultValue: 'ltr',
toolbar: {
icon: 'globe',
items: [
{ value: 'ltr', title: 'LTR' },
{ value: 'rtl', title: 'RTL' },
],
},
},
componentsTheme: {
name: 'Theme',
description: 'Change the components theme. (Work in progress)',
defaultValue: 'default',
toolbar: {
icon: 'paintbrush',
items: [
{ value: 'default', title: 'Default' },
{ value: 'darkBg', title: 'Dark (background)' },
{ value: 'lightGrayBg', title: 'Light gray (background)' },
{ value: 'classic', title: 'Classic (accent)' },
],
},
},
css: {
name: 'Global CSS',
description:
'Inject global CSS that may be loaded in certain contexts.',
defaultValue: 'basic',
toolbar: {
icon: 'document',
items: [
{ value: 'none', title: 'None' },
{ value: 'basic', title: 'Font only' },
{
value: 'wordpress',
title: 'WordPress (common, forms, dashicons)',
},
],
},
},
marginChecker: {
name: 'Margin Checker',
description:
'Show a div before and after the component to check for unwanted margins.',
defaultValue: 'hide',
toolbar: {
icon: 'collapse',
items: [
{ value: 'hide', title: 'Hide' },
{ value: 'show', title: 'Show' },
],
},
},
maxWidthWrapper: {
name: 'Max-Width Wrapper',
description: 'Wrap the component in a div with a max-width.',
defaultValue: 'none',
toolbar: {
icon: 'outline',
items: [
{ value: 'none', title: 'None' },
{ value: 'wordpress-sidebar', title: 'WP Sidebar' },
{ value: 'small-container', title: 'Small container' },
{ value: 'large-container', title: 'Large container' },
],
},
},
};
export const decorators = [
WithGlobalCSS,
WithMarginChecker,
WithRTL,
WithMaxWidthWrapper,
WithTheme,
];
export const parameters = {
// For @geometricpanda/storybook-addon-badges
badgesConfig,
controls: {
sort: 'requiredFirst',
},
docs: {
controls: {
sort: 'requiredFirst',
},
// Flips the order of the description and the primary component story
// so the component is always visible before the fold.
page: () => (
<>
<Title />
<Subtitle />
<Primary />
<Description />
<Controls />
<Stories includePrimary={ false } />
</>
),
},
options: {
storySort: {
order: [
'Docs',
'Playground',
'BlockEditor',
'Components',
[
'Introduction',
'Contributing Guidelines',
'Actions',
'Containers',
'Feedback',
'Layout',
'Navigation',
'Overlays',
'Selection & Input',
[ 'Color', 'Common', 'File Upload', 'Time & Date' ],
'Typography',
'Utilities',
],
'Components (Experimental)',
[
'Actions',
'Layout',
'Navigation',
'Overlays',
'Selection & Input',
'Typography',
],
'Icons',
],
},
},
sourceLinkPrefix: 'https://github.com/WordPress/gutenberg/blob/trunk/',
};
export const tags = [ 'autodocs' ];