import copy from '../js/data/copy.json';
import {
isNotNullNorUndefined,
parseDate,
formatterWithYear
} from '../js/utilities';
import React from 'react';
import Spinner from './presentational/Spinner';
import CardTimestamp from './presentational/CardTimestamp';
import CardLocation from './presentational/CardLocation';
import CardCaret from './presentational/CardCaret';
import CardTags from './presentational/CardTags';
import CardSummary from './presentational/CardSummary';
import CardSource from './presentational/CardSource';
import CardCategory from './presentational/CardCategory';
import CardNarrative from './presentational/CardNarrative';
class Card extends React.Component {
constructor(props) {
super(props);
this.state = {
isHighlighted: false
};
}
toggle() {
this.setState({
isHighlighted: !this.state.isHighlighted
}, () => {
if (!this.state.isHighlighted) {
this.props.highlight(this.props.event);
} else {
this.props.highlight(null);
}
});
}
makeTimelabel(timestamp) {
if (timestamp === null) return null;
const parsedTimestamp = parseDate(timestamp);
const timelabel = formatterWithYear(parsedTimestamp);
return timelabel;
}
renderCategory() {
const categoryTitle = copy[this.props.language].cardstack.category;
const categoryLabel = this.props.event.category;
const color = this.props.getCategoryColor(this.props.event.category);
return (