This commit is contained in:
dzannotti 2015-08-08 00:00:03 +01:00
parent deb9fa6225
commit b74e977974
4 changed files with 4 additions and 30 deletions

View File

@ -3,7 +3,6 @@ import reactMixin from 'react-mixin';
import { ExpandedStateHandlerMixin } from './mixins';
import JSONArrow from './JSONArrow';
import grabNode from './grab-node';
import hexToRgb from '../../utils/hexToRgb';
const styles = {
base: {
@ -97,8 +96,7 @@ export default class JSONArrayNode extends React.Component {
containerStyle = {
...styles.base,
...styles.parentNode
}
};
if (this.state.expanded) {
spanStyle = {
...spanStyle,

View File

@ -3,8 +3,6 @@ import reactMixin from 'react-mixin';
import { ExpandedStateHandlerMixin } from './mixins';
import JSONArrow from './JSONArrow';
import grabNode from './grab-node';
import shallowEqual from '../../utils/shallowEqual';
import hexToRgb from '../../utils/hexToRgb';
const styles = {
base: {
@ -86,6 +84,7 @@ export default class JSONObjectNode extends React.Component {
}
render() {
console.log('render');
let childListStyle = {
padding: 0,
margin: 0,

View File

@ -1,8 +1,8 @@
export default function(hex) {
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
}

View File

@ -1,23 +0,0 @@
export default function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
const keysA = Object.keys(objA);
const keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
const hasOwn = Object.prototype.hasOwnProperty;
for (let i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) ||
objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}