Skip to content

Commit 3876b96

Browse files
iberdinsky-skillddawehner
authored andcommitted
implemented figma. added few widgets. (#710)
* implemented figma. added few widgets. * added figma to components workspace, added test
1 parent 9da2319 commit 3876b96

File tree

7 files changed

+124
-61
lines changed

7 files changed

+124
-61
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import '@storybook/addon-actions/register';
22
import 'storybook-addon-jsx/register';
33
import '@storybook/addon-knobs/register'
4+
import 'storybook-addon-figma/register'

packages/admin-ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"react-test-renderer": "^16.6.3",
8181
"redux-saga-test-plan": "^3.6.0",
8282
"storybook": "^1.0.0",
83+
"storybook-addon-figma": "^0.1.0",
8384
"storybook-addon-jsx": "^5.3.0",
8485
"typescript-eslint-parser": "^21.0.1"
8586
},

packages/admin-ui/src/components/02_atoms/Widgets/Widgets.stories.js

Lines changed: 80 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from 'react';
22
// eslint-disable-next-line import/no-extraneous-dependencies
33
import { storiesOf } from '@storybook/react';
44
// eslint-disable-next-line import/no-extraneous-dependencies
5+
import figmaDecorator from 'storybook-addon-figma';
6+
// eslint-disable-next-line import/no-extraneous-dependencies
57
import { action } from '@storybook/addon-actions';
68
// eslint-disable-next-line import/no-extraneous-dependencies
79
import { boolean, number, object, text } from '@storybook/addon-knobs/react';
@@ -41,13 +43,20 @@ const item = i => {
4143
};
4244
};
4345

44-
storiesOf('Widgets/BooleanCheckbox', module).addWithJSX('Default', () => (
45-
<BooleanCheckbox
46-
fieldName="ControlOne"
47-
label={text('BooleanCheckbox: label', 'CheckBox')}
48-
onChange={onChangeAction}
49-
/>
50-
));
46+
storiesOf('Widgets/BooleanCheckbox', module)
47+
.addDecorator(
48+
figmaDecorator({
49+
url:
50+
'https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system?node-id=2061%3A2386',
51+
}),
52+
)
53+
.addWithJSX('Default', () => (
54+
<BooleanCheckbox
55+
fieldName="ControlOne"
56+
label={text('BooleanCheckbox: label', 'CheckBox')}
57+
onChange={onChangeAction}
58+
/>
59+
));
5160

5261
storiesOf('Widgets/DatetimeTimestamp', module).addWithJSX('Default', () => (
5362
<DatetimeTimestamp
@@ -190,46 +199,68 @@ storiesOf('Widgets/NumberTextfield', module).addWithJSX('Default', () => (
190199
/>
191200
));
192201

193-
storiesOf('Widgets/OptionsSelect', module).addWithJSX('Default', () => (
194-
<OptionsSelect
195-
helpText={text('OptionsSelect:helpText', 'Help text.')}
196-
fieldName="option"
197-
inputProps={object('OptionsSelect:inputProps', {
198-
allowed_values: {
199-
one: 'One',
200-
two: 'Two',
201-
three: 'Three',
202-
four: 'Four',
203-
},
204-
allowed_values_function: '',
205-
})}
206-
label={text('OptionsSelect:label', 'A Simple Label')}
207-
onChange={onChangeAction}
208-
schema={object('OptionsSelect: schema', {
209-
enum: ['One', 'Two', 'Three', 'Four'],
210-
default: 'Two',
211-
})}
212-
value={text('OptionsSelect: value', 'Entered text.')}
213-
/>
214-
));
215-
storiesOf('Widgets/StringTextfield', module).addWithJSX('Default', () => (
216-
<StringTextfield
217-
fieldName="userBio"
218-
label={text('StringTextfield: label', 'A Simple Label')}
219-
onChange={onChangeAction}
220-
value={text('StringTextfield: value', 'Entered text.')}
221-
/>
222-
));
202+
storiesOf('Widgets/OptionsSelect', module)
203+
.addDecorator(
204+
figmaDecorator({
205+
url:
206+
'https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system?node-id=2061%3A1971',
207+
}),
208+
)
209+
.addWithJSX('Default', () => (
210+
<OptionsSelect
211+
helpText={text('OptionsSelect:helpText', 'Help text.')}
212+
fieldName="option"
213+
inputProps={object('OptionsSelect:inputProps', {
214+
allowed_values: {
215+
one: 'One',
216+
two: 'Two',
217+
three: 'Three',
218+
four: 'Four',
219+
},
220+
allowed_values_function: '',
221+
})}
222+
label={text('OptionsSelect:label', 'A Simple Label')}
223+
onChange={onChangeAction}
224+
schema={object('OptionsSelect: schema', {
225+
enum: ['One', 'Two', 'Three', 'Four'],
226+
default: 'Two',
227+
})}
228+
value={text('OptionsSelect: value', 'Entered text.')}
229+
/>
230+
));
223231

224-
storiesOf('Widgets/TextTextarea', module).addWithJSX('Default', () => (
225-
<TextTextarea
226-
fieldName="SummaryText"
227-
label={text('TextTextarea: label', 'A Simple wysiwyg editor')}
228-
name="summaryText"
229-
onChange={onChangeAction}
230-
value={object('TextTextarea: value', {
231-
value:
232-
'Lorem ipsum dolor sit amet, <b>consectetur adipiscing elit</b>, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
233-
})}
234-
/>
235-
));
232+
storiesOf('Widgets/StringTextfield', module)
233+
.addDecorator(
234+
figmaDecorator({
235+
url:
236+
'https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system?node-id=2057%3A1349',
237+
}),
238+
)
239+
.addWithJSX('Default', () => (
240+
<StringTextfield
241+
fieldName="userBio"
242+
label={text('StringTextfield: label', 'A Simple Label')}
243+
onChange={onChangeAction}
244+
value={text('StringTextfield: value', 'Entered text.')}
245+
/>
246+
));
247+
248+
storiesOf('Widgets/TextTextarea', module)
249+
.addDecorator(
250+
figmaDecorator({
251+
url:
252+
'https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system?node-id=2061%3A1805',
253+
}),
254+
)
255+
.addWithJSX('Default', () => (
256+
<TextTextarea
257+
fieldName="SummaryText"
258+
label={text('TextTextarea: label', 'A Simple wysiwyg editor')}
259+
name="summaryText"
260+
onChange={onChangeAction}
261+
value={object('TextTextarea: value', {
262+
value:
263+
'Lorem ipsum dolor sit amet, <b>consectetur adipiscing elit</b>, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
264+
})}
265+
/>
266+
));
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import '@storybook/addon-actions/register';
22
import 'storybook-addon-jsx/register';
33
import '@storybook/addon-knobs/register'
4+
import 'storybook-addon-figma/register'

packages/components/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@babel/preset-env": "^7.1.6",
2323
"@babel/preset-react": "^7.0.0",
2424
"@storybook/addon-actions": "^5.0.0",
25+
"storybook-addon-figma": "^0.1.0",
2526
"@storybook/addon-knobs": "^5.0.0",
2627
"@storybook/addons": "^5.0.0",
2728
"@storybook/react": "^5.0.0",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
/* eslint-disable import/no-extraneous-dependencies */
3+
import { storiesOf } from '@storybook/react';
4+
import figmaDecorator from 'storybook-addon-figma';
5+
import { text } from '@storybook/addon-knobs/react';
6+
/* eslint-enable import/no-extraneous-dependencies */
7+
import AdminUIButton from './Button';
8+
9+
const buttonText = 'Button';
10+
11+
storiesOf('AdminUIButton', module)
12+
.addDecorator(
13+
figmaDecorator({
14+
url:
15+
'https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system?node-id=656%3A491',
16+
}),
17+
)
18+
.addWithJSX('Default', () => (
19+
<AdminUIButton variant="contained">
20+
{text('Button Text', buttonText)}
21+
</AdminUIButton>
22+
));

yarn.lock

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@
10531053
dependencies:
10541054
regenerator-runtime "^0.12.0"
10551055

1056-
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.3":
1056+
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.2.0", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.2":
10571057
version "7.4.3"
10581058
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.3.tgz#79888e452034223ad9609187a0ad1fe0d2ad4bdc"
10591059
integrity sha512-9lsJwJLxDh/T3Q3SZszfWOTkk3pHbkmH+3KY+zwIDmsNlxsumuhS2TH3NIpktU4kNvfzy+k3eLT7aTJSPTo0OA==
@@ -8100,7 +8100,7 @@ hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.0:
81008100
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47"
81018101
integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==
81028102

8103-
hoist-non-react-statics@^3.2.1, hoist-non-react-statics@^3.3.0:
8103+
hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.2.1, hoist-non-react-statics@^3.3.0:
81048104
version "3.3.0"
81058105
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#b09178f0122184fb95acf525daaecb4d8f45958b"
81068106
integrity sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==
@@ -13079,7 +13079,7 @@ react-inspector@^2.3.0, react-inspector@^2.3.1:
1307913079
is-dom "^1.0.9"
1308013080
prop-types "^15.6.1"
1308113081

13082-
react-is@^16.5.2, react-is@^16.6.3, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6:
13082+
react-is@^16.5.2, react-is@^16.6.0, react-is@^16.6.3, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6:
1308313083
version "16.8.6"
1308413084
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16"
1308513085
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==
@@ -13138,17 +13138,18 @@ react-redux-loading-bar@^4.1.0:
1313813138
prop-types "^15.6.2"
1313913139
react-lifecycles-compat "^3.0.2"
1314013140

13141-
react-redux@^7.0.0:
13142-
version "7.0.2"
13143-
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.0.2.tgz#34b280a3482aaf60e7d4a504b1295165cbe6b86a"
13144-
integrity sha512-uKRuMgQt8dWbcz0U75oFK5tDo3boyAKrqvf/j94vpqRFFZfyDDy4kofUgloFIGyuKTq2Zz51zgK9RzOTFXk5ew==
13141+
react-redux@^5.0.7:
13142+
version "5.1.1"
13143+
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.1.1.tgz#88e368682c7fa80e34e055cd7ac56f5936b0f52f"
13144+
integrity sha512-LE7Ned+cv5qe7tMV5BPYkGQ5Lpg8gzgItK07c67yHvJ8t0iaD9kPFPAli/mYkiyJYrs2pJgExR2ZgsGqlrOApg==
1314513145
dependencies:
13146-
"@babel/runtime" "^7.4.3"
13147-
hoist-non-react-statics "^3.3.0"
13146+
"@babel/runtime" "^7.1.2"
13147+
hoist-non-react-statics "^3.1.0"
1314813148
invariant "^2.2.4"
13149-
loose-envify "^1.4.0"
13150-
prop-types "^15.7.2"
13151-
react-is "^16.8.6"
13149+
loose-envify "^1.1.0"
13150+
prop-types "^15.6.1"
13151+
react-is "^16.6.0"
13152+
react-lifecycles-compat "^3.0.0"
1315213153

1315313154
react-resize-detector@^3.2.1:
1315413155
version "3.4.0"
@@ -14708,6 +14709,11 @@ stealthy-require@^1.1.1:
1470814709
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
1470914710
integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=
1471014711

14712+
storybook-addon-figma@^0.1.0:
14713+
version "0.1.0"
14714+
resolved "https://registry.yarnpkg.com/storybook-addon-figma/-/storybook-addon-figma-0.1.0.tgz#4c1e1af62e822aebd43332c43b7c3b63dc6ba4e8"
14715+
integrity sha512-OQztazEB8h12DUjRCRW/g40OfiJsek1nBQXx5PIy9jXl+1kfQyVOmXIj3NuECzjCwLagnlKubZybRVHoTkusdA==
14716+
1471114717
storybook-addon-jsx@^5.3.0:
1471214718
version "5.4.0"
1471314719
resolved "https://registry.yarnpkg.com/storybook-addon-jsx/-/storybook-addon-jsx-5.4.0.tgz#3e703bdecf54621269f2aa394004265cf1e9bda9"

0 commit comments

Comments
 (0)