diff --git a/src/components/categorical/categorical.js b/src/components/categorical/categorical.js index 96dac589..149dab01 100644 --- a/src/components/categorical/categorical.js +++ b/src/components/categorical/categorical.js @@ -6,9 +6,7 @@ import * as globals from "../../globals"; import styles from "./categorical.css"; import SectionHeader from "../framework/sectionHeader" import createCategoryCounts from "./createCategoryCounts"; -import { alphabeticallySortedValues } from "../../util"; - -import cells from "../../../data/GBM_metadata.js"; +import { alphabeticallySortedValues } from "./util"; class Button extends React.Component { render () { @@ -20,18 +18,19 @@ class Button extends React.Component { border: "none", background: "none", color: "black", - padding: "7px 10px", marginRight: 3, - cursor: "pointer" + cursor: "pointer", }}> {this.props.value} {this.props.count} @@ -40,18 +39,19 @@ class Button extends React.Component { } } - const Category = ({category, values, handleClick}) => (

{category}:

{ @@ -72,11 +72,21 @@ const Category = ({category, values, handleClick}) => ( ) @connect((state) => { + + let ranges = null; + + if ( + state.cells.cells && + state.cells.cells.data.ranges + ) { + ranges = state.cells.cells.data.ranges; + } + return { - foo123: state + ranges: ranges } }) -class Categorical extends React.Component { +class Categories extends React.Component { constructor(props) { super(props); this.state = { @@ -89,21 +99,26 @@ class Categorical extends React.Component { } } render () { + if (!this.props.ranges) return null return (
- -

Sort by: Alphabetical / Count || Show counts: true / false || Collapse: all / none

{ - _.map(createCategoryCounts(cells), - (value, key) => { - return ( - - ) + _.map(this.props.ranges, (value, key) => { + if ( + value.options && + key !== "CellName" + ) { + return ( + + ) + } else { + return null + } }) }
@@ -111,12 +126,15 @@ class Categorical extends React.Component { } }; -export default Categorical; +export default Categories; /* [on off] toggle hide deselected filters (shows a menu vs shows what you ordered in compact/narrative form. fold out animation.) +

Sort by: Alphabetical / Count || Show counts: true / false || Collapse: all / none

+ +

diff --git a/src/util/index.js b/src/components/categorical/util.js similarity index 100% rename from src/util/index.js rename to src/components/categorical/util.js