mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-02 04:28:11 +08:00
Prettier
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
// jshint esversion: 6
|
||||
import { connect } from "react-redux";
|
||||
import React from "react";
|
||||
import * as globals from "../../globals";
|
||||
import actions from "../../actions";
|
||||
|
||||
@connect((state) => {
|
||||
@connect(state => {
|
||||
return {
|
||||
categoricalAsBooleansMap: state.controls.categoricalAsBooleansMap,
|
||||
colorScale: state.controls.colorScale,
|
||||
colorAccessor: state.controls.colorAccessor,
|
||||
}
|
||||
colorAccessor: state.controls.colorAccessor
|
||||
};
|
||||
})
|
||||
class CategoryValue extends React.Component {
|
||||
|
||||
toggleOff() {
|
||||
this.props.dispatch({
|
||||
type: "categorical metadata filter deselect",
|
||||
@@ -28,11 +28,16 @@ class CategoryValue extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
render () {
|
||||
if (!this.props.categoricalAsBooleansMap) return null
|
||||
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 */
|
||||
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 (
|
||||
<div
|
||||
@@ -41,32 +46,42 @@ class CategoryValue extends React.Component {
|
||||
display: "flex",
|
||||
alignItems: "baseline",
|
||||
justifyContent: "space-between",
|
||||
fontWeight: selected ? 700 : 400,
|
||||
}}>
|
||||
<p style={{
|
||||
fontWeight: selected ? 700 : 400
|
||||
}}
|
||||
>
|
||||
<p
|
||||
style={{
|
||||
paddingLeft: 15,
|
||||
width: 200,
|
||||
flexShrink: 0,
|
||||
margin: 0,
|
||||
lineHeight: "1em"
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<input
|
||||
onChange={selected ? this.toggleOff.bind(this) : this.toggleOn.bind(this)}
|
||||
onChange={
|
||||
selected ? this.toggleOff.bind(this) : this.toggleOn.bind(this)
|
||||
}
|
||||
checked={selected}
|
||||
type="checkbox"/>
|
||||
{this.props.value}
|
||||
type="checkbox"
|
||||
/>
|
||||
{this.props.value}
|
||||
</p>
|
||||
<p style={{
|
||||
<p
|
||||
style={{
|
||||
padding: "1px 10px",
|
||||
backgroundColor: c ? this.props.colorScale(this.props.value) : "inherit",
|
||||
backgroundColor: c
|
||||
? this.props.colorScale(this.props.value)
|
||||
: "inherit",
|
||||
color: c ? "white" : "black",
|
||||
margin: 0,
|
||||
lineHeight: "1em"
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
{this.props.count}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user