UNPKG

@macrostrat/column-components

Version:

React rendering primitives for stratigraphic columns

73 lines (64 loc) 2.45 kB
import {FaciesContext as $eCcja$FaciesContext} from "./column-components.0ccab336.js"; import {FaciesSwatch as $513054fd2f38b672$export$a3eca1b02e3b1d92} from "./column-components.28b49b3b.js"; import {Component as $eCcja$Component} from "react"; import $eCcja$macrostrathyper from "@macrostrat/hyper"; import $eCcja$classnames from "classnames"; const $68257a91edf5c09a$export$55560e413af7340b = ({ facies: facies })=>(0, $eCcja$macrostrathyper)("div.header", [ (0, $eCcja$macrostrathyper)("p.name", { style: { marginRight: 20, textAlign: "left" } }, facies.name), (0, $eCcja$macrostrathyper)((0, $513054fd2f38b672$export$a3eca1b02e3b1d92), { facies: facies }) ]); class $68257a91edf5c09a$export$addc126cc23af936 extends (0, $eCcja$Component) { constructor(props){ super(props); this.renderEach = this.renderEach.bind(this); } static{ this.contextType = (0, $eCcja$FaciesContext); } static{ this.defaultProps = { selected: null, isEditable: false }; } renderEach(d) { let onClick = null; const style = {}; if (this.props.onClick != null) { onClick = ()=>this.props.onClick(d); style.cursor = "pointer"; } const { selected: selected } = this.props; if (selected === d.id) { style.backgroundColor = d.color; style.color = "white"; } const className = (0, $eCcja$classnames)({ selected: selected === d.id }); return (0, $eCcja$macrostrathyper)("div.facies.bp3-card.bp3-elevation-0", { key: d.id, onClick: onClick, style: style, className: className }, (0, $eCcja$macrostrathyper)($68257a91edf5c09a$export$55560e413af7340b, { facies: d })); } render() { const { facies: facies } = this.context; return (0, $eCcja$macrostrathyper)("div.facies-description-small", [ (0, $eCcja$macrostrathyper)("h5", "Facies"), (0, $eCcja$macrostrathyper)("div", facies.map(this.renderEach)) ]); } } export {$68257a91edf5c09a$export$55560e413af7340b as FaciesCard, $68257a91edf5c09a$export$addc126cc23af936 as FaciesDescriptionSmall}; //# sourceMappingURL=column-components.ec7ed866.js.map