How to use the react-color.TwitterPicker.defaultProps function in react-color

To help you get started, we’ve selected a few react-color examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tier4 / AutomanTools / front / app / dashboard / components / project / klassset_klass_table.jsx View on Github external
handleClickAdd = () => {
    let name = this.refInputName.current.value;
    // TODO: Name Validation
    this.refInputName.current.value = '';
    let sameNameKlasses = this.state.klasses.filter(function(klass) {
      return klass.name == name;
    });
    let targetKlass = {};
    if (sameNameKlasses.length > 0) {
      alert('Already registered.');
    } else {
      targetKlass.name = name;
    }
    const defaultColors = TwitterPicker.defaultProps.colors;
    const labelType = this.props.currentProject.label_type;
    const defaultMinSize = 
      labelType === 'BB2D' ? { x: 10, y: 10 } :
      labelType === 'BB2D3D' ? { x: 10, y: 10, z: 10 } :
      {};
    const idx = this.state.klasses.length;
    targetKlass.color = defaultColors[idx % defaultColors.length];
    targetKlass.minSize = defaultMinSize;
    let clonedKlasses = JSON.parse(JSON.stringify(this.state.klasses));
    clonedKlasses.push(targetKlass);
    this.setState({ klasses: clonedKlasses });
  };
  handleSubmit = () => {