Created
August 8, 2018 18:10
-
-
Save lecroy/a7cdf2bc441f90f405f28ed7c9097a7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './SearchBar.css'; | |
var SortByOptions = { | |
'Best Match': 'best_match', | |
'Highest Rated': 'rating', | |
'Most Reviewed': 'review_count' | |
} | |
class SearchBar extends React.Component { | |
render() { | |
return ( | |
<div className="SearchBar"> | |
<div className="SearchBar-sort-options"> | |
<ul> | |
{renderSortByOptions()} | |
</ul> | |
</div> | |
<div className="SearchBar-fields"> | |
<input placeholder="Search Businesses" /> | |
<input placeholder="Where?" /> | |
</div> | |
<div className="SearchBar-submit"> | |
<a>Lets Go</a> | |
</div> | |
</div> | |
) | |
}; | |
renderSortByOptions() { | |
return Object.keys(sortByOptions).map(sortByOption => { | |
let sortByOptionValue = sortByOptions[sortByOption]; | |
return ( | |
<li key="{sortByOptionValue}"> | |
{sortByOption} | |
</li> | |
); | |
}); | |
} | |
export default SearchBar; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment