import '../scss/main.scss'; import React from 'react'; import Card from './Card.jsx'; import copy from '../js/data/copy.json'; import { isNotNullNorUndefined } from '../js/data/utilities.js'; class CardStack extends React.Component { constructor(props) { super(props); } renderCards() { if (this.props.selected.length > 0) { return this.props.selected.map((event) => { // if event has property 'name', update with event details const shouldCardUpdate = (event.name); return ( ); }); } else { return ''; } } renderLocation() { let locationName = copy[this.props.language].cardstack.unknown_location; if (this.props.selected.length > 0) { if (isNotNullNorUndefined(this.props.selected[0].location)) { locationName = this.props.selected[0].location; } return (

in:{` ${locationName}`}

) } return ''; } render() { const header_lang = copy[this.props.language].cardstack.header; if (this.props.isFetchingEvents) { return (
this.props.toggle('TOGGLE_CARDSTACK')} >

{copy[this.props.language].loading}

); } else if (this.props.selected.length > 0) { return (
this.props.toggle('TOGGLE_CARDSTACK')} >

{`${this.props.selected.length} ${header_lang}`}

{this.renderLocation()}
    {this.renderCards()}
); } return
; } } export default CardStack;