From bbe6107f4982097b1d5f7e3276a3d8d84812029a Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Mon, 23 Oct 2017 12:48:43 -0700 Subject: [PATCH] fire categorical select deselect conditionally --- src/components/categorical/categorical.js | 35 +++++++++++++++++------ 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/components/categorical/categorical.js b/src/components/categorical/categorical.js index aee6604e..fd979227 100644 --- a/src/components/categorical/categorical.js +++ b/src/components/categorical/categorical.js @@ -17,24 +17,26 @@ class Button extends React.Component { render () { /* has this value for this category already been selected? */ + let selected = false; let fontWeight; + if (!this.props.selectedMetadata) { /* there is no selected metadata */ - fontWeight = 400; + selected = false; } else if ( this.props.selectedMetadata[this.props.metadataField] && /* the key {Location: []} is present */ this.props.selectedMetadata[this.props.metadataField].indexOf(this.props.value) > -1 /* "Tumor" exists in {Location: ["Tumor"]} */ ) { - fontWeight = 700 + selected = true; } return (
( +const Category = ({metadataField, values, toggleOn, toggleOff}) => (
( return (