Add color categories correct shade to card

This commit is contained in:
Franc Camps-Febrer
2018-12-03 14:43:13 +00:00
parent 576aceba35
commit 0a6ba78389
7 changed files with 22 additions and 22 deletions

View File

@@ -41,8 +41,10 @@ class Card extends React.Component {
}
renderCategory() {
const eventCat = this.props.event.category || 'other';
const categoryTitle = copy[this.props.language].cardstack.category;
const colorType = this.props.event.category || 'other';
const colorType = this.props.style.categories[eventCat] || this.props.style.categories['other'];
console.log(eventCat, this.props.event.category, this.props.style.categories)
const categoryLabel = this.props.event.category;
return (

View File

@@ -22,6 +22,7 @@ class CardStack extends React.Component {
event={event}
language={this.props.language}
tools={this.props.tools}
style={this.props.style}
isLoading={this.props.isLoading}
getNarrativeLinks={this.props.getNarrativeLinks}
getCategoryGroup={this.props.getCategoryGroup}
@@ -96,8 +97,9 @@ class CardStack extends React.Component {
function mapStateToProps(state) {
return {
selected: state.app.selected,
language: state.app.selected,
language: state.app.language,
tools: state.ui.tools,
style: state.ui.style,
isCardstack: state.ui.flags.isCardstack,
isLoading: state.ui.flags.isFetchingEvents
}

View File

@@ -4,7 +4,7 @@ const CardCategory = ({ categoryTitle, categoryLabel, colorType }) => (
<div className="event-card-section category">
<h4>{categoryTitle}</h4>
<p>
<span className={`color-category ${colorType}`}/>
<span className='color-category' style={{ background: colorType }}/>
{categoryLabel}
</p>
</div>