Working onSelect with respect to caret toggle; onSelect doesnt fire off when caret is selected

This commit is contained in:
efarooqui
2020-09-22 17:12:09 -07:00
parent 2423a5a5ad
commit 930aaaa752
2 changed files with 8 additions and 11 deletions

View File

@@ -27,6 +27,13 @@ class Card extends React.Component {
return makeNiceDate(datetime)
}
handleCardSelect (e) {
if (!e.target.className.includes('arrow-down')) {
const selectedEventFormat = this.props.idx > 0 ? [this.props.event] : this.props.event
this.props.onSelect(selectedEventFormat, this.props.idx)
}
}
renderSummary () {
return (
<CardSummary
@@ -135,21 +142,12 @@ class Card extends React.Component {
render () {
const { isSelected, idx } = this.props
console.info(this.props)
return (
<li
className={`event-card ${isSelected ? 'selected' : ''}`}
id={`event-card-${idx}`}
ref={this.props.innerRef}
onClick={() => {
console.info('getting clicked')
if (!this.state.isOpen) {
const selectedEventFormat = idx > 0 ? [this.props.event] : this.props.event
this.props.onSelect(selectedEventFormat, idx)
} else {
console.info('NOT OPEN')
}
}}
onClick={(e) => this.handleCardSelect(e)}
>
{this.renderMain()}
{this.state.isOpen ? this.renderExtra() : null}

View File

@@ -83,7 +83,6 @@ class Dashboard extends React.Component {
}
handleSelect (selected, axis) {
console.info(selected)
const matchedEvents = []
const TIMELINE_AXIS = 0
if (axis === TIMELINE_AXIS) {