Skip to content

Instantly share code, notes, and snippets.

@bramses
Created May 30, 2019 17:12
Show Gist options
  • Save bramses/d62164b3e68446d1bcb3b1349bb28090 to your computer and use it in GitHub Desktop.
Save bramses/d62164b3e68446d1bcb3b1349bb28090 to your computer and use it in GitHub Desktop.
Algolia Custom Component
import React from "react"
const Menu = ({ items, refine, title }) => (
<div>
<p className="star-wars-facet">{title}</p>
<hr className="star-wars-hr"/>
<ul>
{items.map(item => (
<li style={{ listStyle: 'none' }} key={item.value}>
<a href="#" style={{ fontWeight: item.isRefined ? 'bold' : '', textDecoration: 'none' }} className="star-wars-facet" onClick={event => {
event.preventDefault();
refine(item.value);
}}>
{item.label} ({item.count})
</a>
</li>
))}
</ul>
</div>
)
export default Menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment