Skip to content

Commit

Permalink
Support clickable cards
Browse files Browse the repository at this point in the history
  • Loading branch information
maxatdetroit committed Oct 5, 2023
1 parent 77f6818 commit 2d2b405
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/organisms/Card/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,26 @@ export default class Card extends HTMLElement {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
extraClasses != undefined && extraClasses != null
? cardClasses.push(extraClasses)
? cardClasses.push(extraClasses.split(' '))
: 0;
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
width != undefined && width != null ? (this.card.style.width = width) : 0;
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line eqeqeq
id != undefined && id != null ? (this.card.id = id) : 0;
this.card.className = cardClasses.join(' ');
// Include any existing classes from the element.
this.card.classList.add(...cardClasses);
if (!this.shadowRoot.querySelector('div')) {
this.shadowRoot.appendChild(this.card);
}
}

setIsClickable(isClickable = true, color = null) {
if (isClickable) {
this.card.classList.add('btn', color);
} else {
this.card.classList.remove('btn', color);
}
}
}

0 comments on commit 2d2b405

Please sign in to comment.