react-outline 1.7.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +151 -116
  2. package/dist/Styles.js +34 -35
  3. package/dist/element.js +69 -88
  4. package/dist/main.js +22 -35
  5. package/dist/reactOutline.js +241 -0
  6. package/dist/reactOutline.js.map +7 -0
  7. package/dist/styleItem.js +105 -91
  8. package/dist/utils/buildCssString.js +2 -2
  9. package/dist/utils/genCss.js +21 -32
  10. package/dist/utils/genStyles.js +13 -26
  11. package/dist/utils/hasKids.js +2 -4
  12. package/dist/utils/index.js +81 -61
  13. package/dist/utils/makeid.js +3 -6
  14. package/dist/utils/object2css.js +10 -22
  15. package/dist/utils/pubsub.js +10 -24
  16. package/dist/utils/replaceColors.js +3 -4
  17. package/dist/utils/replacedStyleFn.js +5 -10
  18. package/dist/utils/sanitizeOutlineInput.js +8 -24
  19. package/dist/utils/separateCssStyle.js +5 -8
  20. package/dist/wrapStyles.js +18 -14
  21. package/package.json +36 -24
  22. package/.babelrc +0 -6
  23. package/.npmignore +0 -30
  24. package/.travis.yml +0 -7
  25. package/__snapshots__/cornerCases.test.js.snap +0 -139
  26. package/__snapshots__/example.test.js.snap +0 -408
  27. package/cornerCases.test.js +0 -367
  28. package/dist/utils/sanitizeStyleObj.js +0 -22
  29. package/empty-module.js +0 -1
  30. package/example/.babelrc +0 -4
  31. package/example/.storybook/config.js +0 -7
  32. package/example/.storybook/webpack.config.js +0 -14
  33. package/example/README.md +0 -11
  34. package/example/package.json +0 -55
  35. package/example/stories/Animate/basic.js +0 -73
  36. package/example/stories/Basics/CreatingAndApplyingAStyle.js +0 -12
  37. package/example/stories/Basics/Form.js +0 -24
  38. package/example/stories/Basics/ImpliedTags.js +0 -40
  39. package/example/stories/Basics/PassingStyleAndFuntion.js +0 -13
  40. package/example/stories/Basics/PassingStyleAndFuntionAsArray.js +0 -13
  41. package/example/stories/Basics/ReusingElements.js +0 -13
  42. package/example/stories/Basics/Share.js +0 -19
  43. package/example/stories/Basics/UsingTheTagCreater.js +0 -13
  44. package/example/stories/Basics/WrappingAnExistingElement.js +0 -19
  45. package/example/stories/Button.js +0 -27
  46. package/example/stories/CSSHelpers/CssSelector.js +0 -24
  47. package/example/stories/CSSHelpers/CssSource.js +0 -18
  48. package/example/stories/CSSHelpers/DynamicCssSelectors.js +0 -24
  49. package/example/stories/CSSHelpers/Hover.js +0 -20
  50. package/example/stories/CSSHelpers/MediaQuery.js +0 -22
  51. package/example/stories/CSSHelpers/VendorPrefix.js +0 -19
  52. package/example/stories/CombineStyles/CreatingAndApplyingAStyle.js +0 -16
  53. package/example/stories/CombineStyles/LogicFnWithGenerateElement.js +0 -16
  54. package/example/stories/CombineStyles/PassStyleObjToGenerateElement.js +0 -9
  55. package/example/stories/CombineStyles/UsingAPropFlag.js +0 -16
  56. package/example/stories/CombineStyles/UsingTheTagCreater.js +0 -16
  57. package/example/stories/Ref/byFn.js +0 -51
  58. package/example/stories/Ref/onEvent.js +0 -43
  59. package/example/stories/RuntimeFunctions/DynamicStyles.js +0 -32
  60. package/example/stories/RuntimeFunctions/FunctionWithOutStyle.js +0 -31
  61. package/example/stories/RuntimeFunctions/ModifyingStyles.js +0 -36
  62. package/example/stories/RuntimeFunctions/WithGeneratedElements.js +0 -38
  63. package/example/stories/Welcome.js +0 -90
  64. package/example/stories/index.js +0 -88
  65. package/example/stories/load.js +0 -229
  66. package/example.test.js +0 -16
  67. package/source/Styles.js +0 -23
  68. package/source/element.js +0 -100
  69. package/source/main.js +0 -56
  70. package/source/styleItem.js +0 -105
  71. package/source/utils/buildCssString.js +0 -6
  72. package/source/utils/genCss.js +0 -30
  73. package/source/utils/genStyles.js +0 -19
  74. package/source/utils/hasKids.js +0 -6
  75. package/source/utils/index.js +0 -33
  76. package/source/utils/makeid.js +0 -9
  77. package/source/utils/object2css.js +0 -20
  78. package/source/utils/pubsub.js +0 -22
  79. package/source/utils/replaceColors.js +0 -11
  80. package/source/utils/replacedStyleFn.js +0 -30
  81. package/source/utils/sanitizeOutlineInput.js +0 -72
  82. package/source/utils/sanitizeStyleObj.js +0 -13
  83. package/source/utils/separateCssStyle.js +0 -25
  84. package/source/wrapStyles.js +0 -30
@@ -1,367 +0,0 @@
1
-
2
- import React from 'react';
3
- import faker from 'faker';
4
- import outline, { withOptions, setOptions } from "react-outline"
5
- import { Styles, testing } from 'react-outline'
6
- import { shallow, mount, render } from 'enzyme';
7
- import renderer from 'react-test-renderer';
8
-
9
- function randomColor(){
10
- return '#'+Math.floor(Math.random()*16777215).toString(16);
11
- }
12
-
13
- function classNameGen(){
14
- return faker.internet.userName()
15
- }
16
-
17
- describe('With Options at style level', () => {
18
- it('Not passing a options object should throw', () => {
19
- expect(() => {
20
- withOptions()
21
- }).toThrow();
22
- })
23
-
24
- it('Using options to set color short-hand', () => {
25
-
26
- const custom_outline = withOptions({colors:{primary:"#ABC123"}})
27
-
28
- const fooN = classNameGen();
29
- const barN = classNameGen();
30
-
31
- const css = {
32
- base : {
33
- [fooN]:{ color:"primary" },
34
- [barN]:{ color:"red" }
35
- }
36
- }
37
- const styles = custom_outline(css);
38
-
39
- const foo = shallow(<div style={styles[fooN]()}/>);
40
- const bar = shallow(<div style={styles[barN]()}/>);
41
-
42
- expect(bar.prop("style")).toEqual({ color:"red" })
43
- expect(foo.prop("style")).toEqual({ color:"#ABC123" })
44
- })
45
-
46
- it('Using options to set caching (base + fn)', () => {
47
-
48
- const custom_outline = withOptions({caching:true})
49
-
50
- const color = randomColor();
51
- const barN = classNameGen();
52
-
53
- const css = {
54
- base:{[barN]:{backgroundColor:"yellow"}},
55
- // USE a random color
56
- [barN] : ()=>({color})
57
- }
58
- const styles = custom_outline(css);
59
-
60
- const baz1 = shallow(<div style={styles[barN]()}/>);
61
- // baz2 will return the same style as baz1 cached value
62
- const baz2 = shallow(<div style={styles[barN]()}/>);
63
-
64
- expect(css[barN]()).not.toBe(css[barN]());
65
- expect(baz1.prop("style")).toHaveProperty("color");
66
- expect(baz1.prop("style").color).toEqual(color);
67
- expect(baz1.prop("style")).toEqual(baz2.prop("style"));
68
- })
69
-
70
- it('Using options to set caching (base)', () => {
71
-
72
- const custom_outline = withOptions({caching:true})
73
- const barN = classNameGen();
74
-
75
- const css = {
76
- base:{[barN]:{color:"white"}},
77
- }
78
- const styles = custom_outline(css);
79
-
80
- const baz1 = shallow(<div style={styles[barN]()}/>);
81
- // baz2 will return the same style as baz1 cached value
82
- const baz2 = shallow(<div style={styles[barN]()}/>);
83
-
84
- expect(css.base[barN]).toEqual(styles[barN]());
85
- expect(baz1.prop("style")).toHaveProperty("color")
86
- expect(baz1.prop("style")).toEqual(baz2.prop("style"));
87
- })
88
-
89
- it('Using options to set caching (fn)', () => {
90
-
91
- const custom_outline = withOptions({caching:true})
92
- const barN = classNameGen();
93
-
94
- const css = {
95
- // USE a random color
96
- [barN] : ()=>({color:randomColor()})
97
- }
98
- const styles = custom_outline(css);
99
-
100
- const baz1 = shallow(<div style={styles[barN]()}/>);
101
- // baz2 will return the same style as baz1 cached value
102
- const baz2 = shallow(<div style={styles[barN]()}/>);
103
-
104
- expect(baz1.prop("style")).toHaveProperty("color")
105
- expect(baz1.prop("style")).toEqual(baz2.prop("style"));
106
- })
107
- })
108
-
109
- describe('In production mode', () => {
110
-
111
- beforeAll(() => global.__TEST__ = false);
112
- afterAll( () => global.__TEST__ = true);
113
-
114
- it('should throw if no style values are passed', () => {
115
- expect(() => {
116
- styles = outline();
117
- }).toThrow();
118
- })
119
-
120
- it('should throw if a style value is not object or function', () => {
121
- expect(() => {
122
- styles = outline({[classNameGen()]:classNameGen()}); // random name with random value
123
- }).toThrow();
124
- })
125
-
126
- it('generated elements using CSS features need a unique class', () => {
127
-
128
- const titleN = classNameGen();
129
-
130
- let styles = {
131
- base : {
132
- [titleN]:{
133
- base:{ background: "lightblue", color:"black" },
134
- ":hover":{ background: "darkblue" , color:"white" }
135
- }
136
- }
137
- }
138
- styles = outline(styles);
139
-
140
- const Title = styles[titleN]`div`
141
-
142
- const elem = shallow(<Title/>);
143
- expect(elem.prop("className")).toMatch(/^react-outline-[a-zA-Z0-9]{10}$/)
144
- })
145
-
146
- it('should run style function once if cased and same input', () => {
147
- let callCount = 0;
148
- let styles = {
149
- crazyElem : (x)=> callCount++
150
- };
151
- styles = outline(styles,{caching:true}); // random name with random value
152
-
153
- styles.crazyElem(5);
154
- styles.crazyElem(5);
155
-
156
- expect(callCount).toEqual(1);
157
- })
158
-
159
- it('should be able to pass an value to style logic', () => {
160
- const css = { };
161
- const logic = { dogs: val => ({ color: "string" === typeof val ? "white" : "black" }) };
162
- const styles = outline(css,logic); // random name with random value
163
-
164
- const Dogs = styles.dogs`div`;
165
- expect(renderer.create(<Dogs style={"boo"} />).toJSON()).toMatchSnapshot();
166
- expect(renderer.create(<Dogs style={7} />).toJSON()).toMatchSnapshot();
167
- })
168
-
169
- it('should be able to destructur assignments on generated element', () => {
170
- const css = { };
171
- const logic = { cats: ({number})=> ({ color: number > 5 ? "blue" : "pink" }) };
172
- const styles = outline(css,logic); // random name with random value
173
-
174
- const Cats = styles.cats`div`;
175
- expect(renderer.create(<Cats style={{number:2}} />).toJSON()).toMatchSnapshot();
176
- expect(renderer.create(<Cats style={{number:7}} />).toJSON()).toMatchSnapshot();
177
- })
178
-
179
- it('should be able to pass true value', () => {
180
- const css = {
181
- input : {
182
- base:{color: "red"},
183
- big:{fontSize: "20px"}
184
- }
185
- };
186
- const logic = { input: ()=> ({ background: "gray" }) };
187
- const styles = outline(css,logic); // random name with random value
188
-
189
- const Input = styles.input``;
190
- expect(renderer.create(<Input big disabled />).toJSON()).toMatchSnapshot();
191
- })
192
- /*
193
- it('should skip unknown css props', () => {
194
- let styles = {
195
- niceElem : {
196
- base :{color:"black" },
197
- ":hover":{color:"gray"},
198
- "~touch":{color:"boo!"}
199
- }
200
- };
201
- styles = outline(styles); // random name with random value
202
- })*/
203
-
204
-
205
- it('should allow cross cutting style to map to only functions', () => {
206
- const css = {
207
- "foo, bar" : {
208
- fontSize: "20px"
209
- }
210
- };
211
- const logic = {
212
- foo: x => ({ background: "gray" }),
213
- bar: x => ({ background: "black" })
214
- };
215
- const styles = outline(css,logic); // random name with random value
216
-
217
- const Foo = styles.foo`span`;
218
- const Bar = styles.bar`span`;
219
- expect(renderer.create(<Foo style={123} />).toJSON()).toMatchSnapshot();
220
- expect(renderer.create(<Bar style={123} />).toJSON()).toMatchSnapshot();
221
- })
222
-
223
- it('should generated an element with a logic fn that can take undefined', () => {
224
-
225
- // VERSION A
226
- const css = {
227
- foo : { fontSize: "20px" }
228
- };
229
- const logic = {
230
- foo: x => ({ background: "gray" }),
231
- };
232
- const stylesA = outline(css,logic); // random name with random value
233
-
234
- // VERSION B
235
-
236
- const allStyles = {
237
- base: {
238
- foo : { fontSize: "20px" }
239
- },
240
- foo: x => ({ background: "gray" })
241
- };
242
- const stylesB = outline(allStyles); // random name with random value
243
-
244
- const FooA = stylesA.foo`span`;
245
- const FooB = stylesB.foo`span`;
246
-
247
- expect(renderer.create(<FooA style={undefined} />).toJSON()).toMatchSnapshot();
248
- expect(renderer.create(<FooB style={undefined} />).toJSON())
249
- .toEqual(renderer.create(<FooA style={undefined} />).toJSON());
250
- })
251
-
252
- /*it('should attach dom event to element', () => {
253
-
254
-
255
- styles = outline({ textarea : {} })
256
-
257
- <Textarea onDomEvent={{'scroll': ()=>{
258
-
259
- }}}
260
- defaultValue={"1,2,3,4,5".replace(/,/g,"\n")} />
261
-
262
-
263
- //expect(renderer.create(<FooA style={undefined} />).toJSON()).toMatchSnapshot();
264
- console.log(renderer.create(<FooA style={false}/>).toJSON())
265
- })*/
266
-
267
-
268
-
269
- it.skip('should generated an element with css selector', () => {
270
-
271
- let styles = {
272
- base : {
273
- cell:{
274
- base:{
275
- minHeight: "100%"
276
- },
277
- ">div": {
278
- minHeight: "100%"
279
- }
280
- }
281
- },
282
- cell : x => Object.assign({minHeight: "auto"},x)
283
- };
284
- styles = outline(styles)
285
-
286
- const FooA = styles.cell`${()=><div/>}`;
287
-
288
- //expect(renderer.create(<FooA style={undefined} />).toJSON()).toMatchSnapshot();
289
- console.log(renderer.create(<FooA style={false}/>).toJSON())
290
- })
291
-
292
- })
293
-
294
- describe('CSS selectors', () => {
295
- it('should work with user defined callNames', () => {
296
-
297
- testing.resetCSS();
298
-
299
- const styles = outline({ a : { based:{}, ":hover":{} },b : { } }); // random name with random value
300
-
301
- const ElemA = styles.a`div`;
302
- const ElemB = styles.b`div`;
303
- expect(renderer.create(<div>
304
- <ElemA className="a" />
305
- <ElemA />
306
- <ElemB className="b"/>
307
- <ElemB />
308
- </div>).toJSON()).toMatchSnapshot();
309
- })
310
- it('should allow you to select a nested element', () => {
311
-
312
- testing.resetCSS();
313
-
314
- const css = {
315
- div : {
316
- base:{color: "red"},
317
- " .abc":{fontSize: "20px"}
318
- }
319
- };
320
- const styles = outline(css); // random name with random value
321
-
322
- const Elem = styles.div``;
323
- expect(renderer.create(<div>
324
- <Styles/>
325
- <Elem/>
326
- </div>).toJSON()).toMatchSnapshot();
327
- })
328
-
329
- it('should allow for color replacment', () => {
330
-
331
- testing.resetCSS();
332
-
333
- const custom_outline = withOptions({colors:{squanchy:"#e5a939"}})
334
-
335
- const css = {
336
- div : {
337
- base:{color: "squanchy"},
338
- " .abc":{fontSize: "20px"}
339
- }
340
- };
341
- const styles = outline(css); // random name with random value
342
-
343
- const Elem = styles.div``;
344
- expect(renderer.create(<div>
345
- <Styles/>
346
- <Elem/>
347
- </div>).toJSON()).toMatchSnapshot();
348
- })
349
-
350
-
351
- })
352
-
353
- describe('Check setOptions', () => {
354
-
355
- it('should throw no options are passed', () => {
356
- expect(() => {
357
- setOptions();
358
- }).toThrow();
359
- })
360
-
361
- it('should allow dev to set custom colours', () => {
362
- const colors = {crazyRed:"RED!"};
363
- expect(outline.colors).toBeUndefined();
364
- setOptions({colors:{crazyRed:"RED!"}});
365
- expect(outline.colors).toEqual(colors);
366
- })
367
- })
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
8
-
9
- exports.default = mirgeStyles;
10
-
11
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
-
13
- function mirgeStyles(x) {
14
- // remove all style values that are 'true'
15
- if (x) return Object.keys(x).reduce(function (a, b) {
16
- var type = _typeof(x[b]);
17
- if ("string" === type || "number" === type || Array.isArray(x[b])) {
18
- Object.assign(a, _defineProperty({}, b, x[b]));
19
- }
20
- return a;
21
- }, {});
22
- }
package/empty-module.js DELETED
@@ -1 +0,0 @@
1
- module.exports = ''
package/example/.babelrc DELETED
@@ -1,4 +0,0 @@
1
-
2
- {
3
- "presets": [ "react", "es2015"]
4
- }
@@ -1,7 +0,0 @@
1
- import { configure } from '@kadira/storybook'
2
-
3
- function loadStories() {
4
- require('../stories');
5
- }
6
-
7
- configure(loadStories, module);
@@ -1,14 +0,0 @@
1
- var path = require("path");
2
-
3
- module.exports = {
4
- resolve:{
5
- alias:{
6
- 'react-outline$':path.join(__dirname, "../../dist/main.js")
7
- }
8
- },
9
- module: {
10
- loaders: [
11
- { test: /\.css$/, loader: "style-loader!css-loader" }
12
- ]
13
- }
14
- };
package/example/README.md DELETED
@@ -1,11 +0,0 @@
1
- # How to run Example / [Live Demo](https://s3.amazonaws.com/react-outline/index.html?down=0)
2
-
3
- 1) `npm install react-outline`
4
- 2) `cd node_modules/react-outline/example/`
5
-
6
- once you are in the "example" folder and run the following commands
7
-
8
- 3) `npm install`
9
- 4) `npm start`
10
-
11
- then open a web brower to http://localhost:6006
@@ -1,55 +0,0 @@
1
- {
2
- "name": "react-outline-example",
3
- "version": "1.0.0",
4
- "description": "Example: a utility of managing your inline style",
5
- "main": "main.jsx",
6
- "scripts": {
7
- "start": "start-storybook -p 6006",
8
- "build": "build-storybook"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git://github.com/codemeasandwich/react-outline.git"
13
- },
14
- "keywords": [
15
- "redux",
16
- "middleware",
17
- "reducers",
18
- "actions",
19
- "example"
20
- ],
21
- "author": "Brian Shannon (http://www.codemeasandwich.com)",
22
- "license": "MPL",
23
- "bugs": {
24
- "url": "https://github.com/codemeasandwich/react-outline/issues"
25
- },
26
- "homepage": "https://github.com/codemeasandwich/react-outline/example#readme",
27
- "dependencies": {
28
- "animate.css": "^3.5.2",
29
- "babel-cli": "^6.24.1",
30
- "babel-core": "^6.24.1",
31
- "babel-loader": "^7.0.0",
32
- "babel-preset-es2015": "^6.24.1",
33
- "babel-preset-react": "^6.24.1",
34
- "html-webpack-plugin": "^2.28.0",
35
- "js-beautify": "^1.7.4",
36
- "react": "^15.6.1",
37
- "react-addons-css-transition-group": "^15.6.0",
38
- "react-dom": "^15.6.1",
39
- "webpack": "^2.5.1",
40
- "webpack-dev-server": "^2.4.5"
41
- },
42
- "devDependencies": {
43
- "@kadira/storybook": "^2.21.0",
44
- "@storybook/addon-info": "^3.2.0",
45
- "babel-plugin-module-resolver": "^2.7.1",
46
- "babel-plugin-transform-object-rest-spread": "^6.23.0",
47
- "babel-preset-env": "^1.6.0",
48
- "babel-preset-stage-0": "^6.24.1",
49
- "babel-preset-stage-2": "^6.24.1",
50
- "css-loader": "^0.28.4",
51
- "raw-loader": "^0.5.1",
52
- "style-loader": "^0.18.2",
53
- "webpack-subresource-integrity": "^1.0.1"
54
- }
55
- }
@@ -1,73 +0,0 @@
1
- import React from 'react';
2
- import ReactCSSTransitionGroup from 'react-addons-css-transition-group'
3
- import outline,{ Styles } from 'react-outline'
4
- import 'animate.css'
5
-
6
- let styles = {
7
- base : {
8
- list:{ listStyleType: "none" },
9
- item:{
10
- base:{ textShadow: "1px 1px 10px #000", color:"white", cursor:"pointer" },
11
- ":hover":{ color:"blue" }
12
- }
13
- }
14
- }
15
- styles = outline(styles);
16
-
17
- const List = styles.list`ul`
18
- const Item = styles.item`li`
19
-
20
- class Panel extends React.Component {
21
- constructor(props) {
22
- super(props);
23
- this.add = this.add.bind(this);
24
- this.state = { data: [], name:'' };
25
- }
26
-
27
- render() {
28
- return (
29
- <div><Styles/>
30
- <input placeholder="Type something here" type="text"
31
- onChange={({target})=>this.setState({name:target.value})}
32
- value={this.state.name}/>
33
- <input onClick={this.add} type="button" value="Add" />
34
- {!!this.state.data.length && <div>click on item to remove</div>}
35
- <List>
36
-
37
- <ReactCSSTransitionGroup
38
- transitionEnterTimeout={600}
39
- transitionLeaveTimeout={600}
40
- transitionName={{enter :"animated",
41
- enterActive :"fadeIn",
42
- leave :"animated",
43
- leaveActive :"fadeOut"}}>
44
- {
45
- this.list()
46
- }
47
- </ReactCSSTransitionGroup>
48
- </List>
49
-
50
- </div>
51
- )
52
- }
53
-
54
- list(){
55
- return this.state.data.map((player,i) =>{
56
- return <Item key={player.id} onClick={()=> this.remove(i) }>{player.name}</Item>
57
- })
58
- }
59
-
60
- add(){
61
- var arr = this.state.data.slice();
62
- arr.push({'id':(new Date()).getTime(),'name':this.state.name})
63
- this.setState({data:arr,name:""})
64
- }
65
-
66
- remove(index){
67
- const data = this.state.data.slice(0);
68
- data.splice( index, 1 )
69
- this.setState({data})
70
- }
71
- }
72
-
73
- export default <Panel/>
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import outline from 'react-outline'
3
-
4
- let styles = {
5
- base : {
6
- title:{ backgroundColor: "red" }
7
- }
8
- }
9
- styles = outline(styles);
10
-
11
- const Title = <div style={styles.title()}>basic</div>
12
- export default Title
@@ -1,24 +0,0 @@
1
-
2
- import React from 'react';
3
- import outline from 'react-outline'
4
-
5
- let styles = {
6
- fullName:{ }
7
- }
8
- styles = outline(styles);
9
-
10
- const FullName = styles.fullName`input`
11
-
12
- const Form = <form onSubmit={handleSubmit}>
13
-
14
- <label htmlFor="fullName">Full Name</label>
15
-
16
- <FullName
17
- type="text"
18
- value={this.state.fullName}
19
- onChange={this.handleFullNameChange} />
20
-
21
- <input type="submit" value="Submit" />
22
- </form>
23
-
24
- export default Form
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- import outline from 'react-outline'
3
-
4
- let styles = {
5
- base : {
6
- table : {
7
- borderCollapse: "collapse",
8
- width: "100%"
9
- },
10
- tr : {
11
- borderBottom: "thick solid red"
12
- },
13
- td : {
14
- border: "1px solid #dddddd",
15
- padding: "8px"
16
- }
17
- }
18
- }
19
- styles = outline(styles);
20
-
21
- // The HTML tag type is implied by the name
22
-
23
- const Table = styles.table``
24
- const Row = styles.tr``
25
- const Cell = styles.td``
26
-
27
- export default <Table>
28
- <Row>
29
- <Cell>Maria Anders</Cell>
30
- <Cell>Germany</Cell>
31
- </Row>
32
- <Row>
33
- <Cell>Francisco Chang</Cell>
34
- <Cell>Mexico</Cell>
35
- </Row>
36
- <Row>
37
- <Cell>Roland Mendel</Cell>
38
- <Cell>Austria</Cell>
39
- </Row>
40
- </Table>
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import outline from 'react-outline'
3
-
4
- let styles = {
5
- title:{ backgroundColor: "red" }
6
- }
7
- const fus = {title:()=> ({ color:"white" }) }
8
-
9
- styles = outline(styles,fus);
10
-
11
- const Title = styles.title`div`
12
-
13
- export default <Title>basic</Title>
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import outline from 'react-outline'
3
-
4
- let styles = {
5
- title:{ backgroundColor: "red" }
6
- }
7
- const fus = {title:()=> ({ color:"white" }) }
8
-
9
- styles = outline([styles,fus]);
10
-
11
- const Title = styles.title`div`
12
-
13
- export default <Title>basic</Title>
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import outline from 'react-outline'
3
-
4
- let styles = {
5
- base : {
6
- title:{ backgroundColor: "red" }
7
- }
8
- }
9
- styles = outline(styles);
10
-
11
- const Title = styles.title`span`
12
-
13
- export default <div><Title>foo</Title><Title>bar</Title></div>