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

View File

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

View File

@ -1,8 +1,8 @@
export default function(hex) { 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 ? { return result ? {
r: parseInt(result[1], 16), r: parseInt(result[1], 16),
g: parseInt(result[2], 16), g: parseInt(result[2], 16),
b: parseInt(result[3], 16) b: parseInt(result[3], 16)
} : null; } : 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;
}