Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 14, 2020. It is now read-only.

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

‎package.json‎

Lines changed: 1 addition & 1 deletion
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
}

‎src/index.js‎

Lines changed: 17 additions & 3 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /