Skip to content

Commit 6fbae2e

Browse files
committed
remove legacy testing code
1 parent 6518177 commit 6fbae2e

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ In this version the defaultTheme is attached to the component itself as static p
6464

6565
https://github.com/nikgraf/future-react-ui/blob/master/ui-lib/Context/Hint.js
6666

67-
In this version we leverage context to build a `<Theme />` component that takes a theme as property and passes it down to all child components via React's context. A theme is still a simple JS object as can be seen on line 25-30. (https://github.com/nikgraf/future-react-ui/blob/master/app/index.js#L22). See how it's used here: https://github.com/nikgraf/future-react-ui/blob/master/app/index.js#L94. On one hand this approach is powerful, because you can apply different themes various nesting levels in the render tree.
67+
In this version we leverage context to build a `<Theme />` component that takes a theme as property and passes it down to all child components via React's context. A theme is still a simple JS object as can be seen on line 25-30. (https://github.com/nikgraf/future-react-ui/blob/master/app/index.js#L22). See how it's used here: https://github.com/nikgraf/future-react-ui/blob/master/app/index.js#L56. On one hand this approach is powerful, because you can apply different themes various nesting levels in the render tree.
6868

6969
```
7070
<Theme theme={baseTheme}>

Diff for: app/index.js

-38
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,6 @@ const theme = {
3131

3232
window.React = React;
3333

34-
var Button = React.createClass({
35-
contextTypes: {
36-
color: React.PropTypes.string,
37-
},
38-
render: function() {
39-
return (
40-
<button style={{background: this.context.color}}>
41-
{this.props.children}
42-
</button>
43-
);
44-
},
45-
});
46-
47-
var Message = React.createClass({
48-
render: function() {
49-
return (
50-
<div>
51-
{this.props.text} <Button>Delete</Button>
52-
</div>
53-
);
54-
},
55-
});
56-
57-
var MessageList = React.createClass({
58-
childContextTypes: {
59-
color: React.PropTypes.string,
60-
},
61-
getChildContext: function() {
62-
return {color: "purple"};
63-
},
64-
65-
render: function() {
66-
return <div>{this.props.children}</div>;
67-
},
68-
});
69-
7034
const App = () => {
7135
return (
7236
<div style={{ width: 600, margin: '0 auto' }}>
@@ -90,12 +54,10 @@ const App = () => {
9054

9155

9256
<h3>Global theme as Theme component leveraging context</h3>
93-
<MessageList>
9457
<Theme theme={theme}>
9558
<Hint3>Basic closed hint without styling.</Hint3>
9659
<Hint3 isOpen>Basic open hint without styling.</Hint3>
9760
</Theme>
98-
</MessageList>
9961

10062
</div>
10163
);

0 commit comments

Comments
 (0)