diff --git a/src/components/categorical/categorical.js b/src/components/categorical/categorical.js index 149dab01..aee6604e 100644 --- a/src/components/categorical/categorical.js +++ b/src/components/categorical/categorical.js @@ -8,38 +8,49 @@ import SectionHeader from "../framework/sectionHeader" import createCategoryCounts from "./createCategoryCounts"; import { alphabeticallySortedValues } from "./util"; +@connect((state) => { + return { + selectedMetadata: state.selectedMetadata + } +}) class Button extends React.Component { render () { + + /* has this value for this category already been selected? */ + let fontWeight; + if (!this.props.selectedMetadata) { /* there is no selected metadata */ + fontWeight = 400; + } 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 + } + return ( - + ) } } -const Category = ({category, values, handleClick}) => ( +const Category = ({metadataField, values, handleClick}) => (
( fontFamily: globals.accentFont, fontStyle: "italic", marginRight: 20, - }}>{category}:

+ }}>{metadataField}:

{ _.map(alphabeticallySortedValues(values), (v, i) => { @@ -60,7 +71,7 @@ const Category = ({category, values, handleClick}) => (