From fc3e2e483fd6b028dcc26fa37b51712de1c325d9 Mon Sep 17 00:00:00 2001 From: Krist Wongsuphasawat Date: Wed, 3 Oct 2018 22:39:02 -0700 Subject: [PATCH] refer to default color scheme in colorpickercontrol instead of pointing to specific scheme --- .../explore/components/ColorPickerControl_spec.jsx | 3 +++ .../src/explore/components/controls/ColorPickerControl.jsx | 5 ++--- superset/assets/src/modules/colors.js | 4 ---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/superset/assets/spec/javascripts/explore/components/ColorPickerControl_spec.jsx b/superset/assets/spec/javascripts/explore/components/ColorPickerControl_spec.jsx index 2285df4230436..1271d62f019b9 100644 --- a/superset/assets/spec/javascripts/explore/components/ColorPickerControl_spec.jsx +++ b/superset/assets/spec/javascripts/explore/components/ColorPickerControl_spec.jsx @@ -8,6 +8,7 @@ import { SketchPicker } from 'react-color'; import ColorPickerControl from '../../../../src/explore/components/controls/ColorPickerControl'; import ControlHeader from '../../../../src/explore/components/ControlHeader'; +import { registerScheme } from '../../../../src/modules/ColorSchemeManager'; const defaultProps = { value: { }, @@ -17,6 +18,8 @@ describe('ColorPickerControl', () => { let wrapper; let inst; beforeEach(() => { + registerScheme('test', ['red', 'green', 'blue']) + .setDefaultSchemeName('test'); wrapper = shallow(); inst = wrapper.instance(); }); diff --git a/superset/assets/src/explore/components/controls/ColorPickerControl.jsx b/superset/assets/src/explore/components/controls/ColorPickerControl.jsx index ecccc8e33cccc..55d7ce48838c5 100644 --- a/superset/assets/src/explore/components/controls/ColorPickerControl.jsx +++ b/superset/assets/src/explore/components/controls/ColorPickerControl.jsx @@ -2,9 +2,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { OverlayTrigger, Popover } from 'react-bootstrap'; import { SketchPicker } from 'react-color'; - import ControlHeader from '../ControlHeader'; -import { bnbColors } from '../../../modules/colors'; +import { getScheme } from '../../../modules/ColorSchemeManager'; const propTypes = { onChange: PropTypes.func, @@ -59,7 +58,7 @@ export default class ColorPickerControl extends React.Component { i < 7)} + presetColors={getScheme().filter((s, i) => i < 7)} /> ); } diff --git a/superset/assets/src/modules/colors.js b/superset/assets/src/modules/colors.js index 0c23d4071fe42..413239c8c82e6 100644 --- a/superset/assets/src/modules/colors.js +++ b/superset/assets/src/modules/colors.js @@ -1,12 +1,8 @@ import d3 from 'd3'; import sequentialSchemes from './colorSchemes/sequential'; -import airbnb from './colorSchemes/airbnb'; -import lyft from './colorSchemes/lyft'; export const brandColor = '#00A699'; export const colorPrimary = { r: 0, g: 122, b: 135, a: 1 }; -export const bnbColors = airbnb.bnbColors; -export const lyftColors = lyft.lyftColors; export function hexToRGB(hex, alpha = 255) { if (!hex) {