Skip to content

Instantly share code, notes, and snippets.

@tmikeschu
Last active July 17, 2017 18:13
Show Gist options
  • Save tmikeschu/d49a5406fe1ea0d9f6303b40cc62fdd2 to your computer and use it in GitHub Desktop.
Save tmikeschu/d49a5406fe1ea0d9f6303b40cc62fdd2 to your computer and use it in GitHub Desktop.
// src/App/Map/Legend/Legend.jsx
import React, { Component } from 'react'
import Category from './Category/Category'
import { categoryIcons } from '../category_data'
export default class Legend extends Component {
categoryIcons() {
return categoryIcons
}
render() {
const legendCategories = this.props.categories.map((category, i) => {
return(
<Category key={i} category={category} />
)
})
return (
<article className="legend">
<h4>Legend</h4>
<ul>
...
<li>
<span>
<img src={this.categoryIcons()["cycling"]} alt="cyclist"/>
</span> → That's Us! ( as of {this.props.date} )
</li>
<li>
<span>
<img src={this.categoryIcons()["endOfDay"]} alt="flag"/>
</span> → Day-to-Day
</li>
{ legendCategories }
</ul>
</article>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment