// jshint esversion: 6 import { connect } from "react-redux"; import React from "react"; import * as globals from "../../globals"; import actions from "../../actions"; @connect(state => { return { categoricalAsBooleansMap: state.controls.categoricalAsBooleansMap, colorScale: state.controls.colorScale, colorAccessor: state.controls.colorAccessor }; }) class CategoryValue extends React.Component { toggleOff() { this.props.dispatch({ type: "categorical metadata filter deselect", metadataField: this.props.metadataField, value: this.props.value }); } toggleOn() { this.props.dispatch({ type: "categorical metadata filter select", metadataField: this.props.metadataField, value: this.props.value }); } render() { if (!this.props.categoricalAsBooleansMap) return null; const selected = this.props.categoricalAsBooleansMap[ this.props.metadataField ][this.props.value]; const c = this.props.metadataField === this.props .colorAccessor; /* this is the color scale, so add swatches below */ return (
{this.props.value}
{this.props.count}