Skip to content

Commit c8a81ed

Browse files
committed
update react-base16-styling
1 parent 95cbd4e commit c8a81ed

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
},
6767
"dependencies": {
6868
"babel-runtime": "^6.6.1",
69-
"react-base16-styling": "^0.4.1"
69+
"react-base16-styling": "^0.5.1"
7070
},
7171
"pre-commit": "lint"
7272
}

Diff for: src/index.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import React, { PropTypes } from 'react';
77
import JSONNode from './JSONNode';
88
import createStylingFromTheme from './createStylingFromTheme';
9+
import { invertTheme } from 'react-base16-styling';
910

1011
const identity = value => value;
1112
const expandRootNode = (keyName, data, level) => level === 0;
@@ -53,9 +54,22 @@ function checkLegacyTheming(theme, props) {
5354
}
5455

5556
function getStateFromProps(props) {
57+
let theme = checkLegacyTheming(props.theme, props);
58+
if (props.invertTheme) {
59+
if (typeof theme === 'string') {
60+
theme = `${theme}:inverted`;
61+
} else if (theme && theme.extend) {
62+
if (typeof theme === 'string') {
63+
theme = { ...theme, extend: `${theme.extend}:inverted` };
64+
} else {
65+
theme = { ...theme, extend: invertTheme(theme.extend) };
66+
}
67+
} else if (theme) {
68+
theme = invertTheme(theme);
69+
}
70+
}
5671
return {
57-
styling: createStylingFromTheme(
58-
checkLegacyTheming(props.theme, props), props.invertTheme)
72+
styling: createStylingFromTheme(theme)
5973
};
6074
}
6175

@@ -115,7 +129,7 @@ export default class JSONTree extends React.Component {
115129
postprocessValue,
116130
hideRoot,
117131
theme, // eslint-disable-line no-unused-vars
118-
invertTheme, // eslint-disable-line no-unused-vars
132+
invertTheme: _, // eslint-disable-line no-unused-vars
119133
...rest
120134
} = this.props;
121135

0 commit comments

Comments
 (0)