Last active
May 5, 2020 00:00
-
-
Save ryanbelke/4ff801d367b4e4353a2b52bd209b1811 to your computer and use it in GitHub Desktop.
/pages/index.js
This file contains hidden or 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
| /* /pages/index.js */ | |
| import React, { useState } from "react"; | |
| import { Col, Input, InputGroup, InputGroupAddon, Row } from "reactstrap"; | |
| import RestaurantList from "../components/RestaurantList"; | |
| function Home() { | |
| const [query, updateQuery] = useState(""); | |
| return ( | |
| <div className="container-fluid"> | |
| <Row> | |
| <Col> | |
| <div className="search"> | |
| <InputGroup> | |
| <InputGroupAddon addonType="append"> Search </InputGroupAddon> | |
| <Input | |
| onChange={e => updateQuery(e.target.value.toLocaleLowerCase())} | |
| value={query} | |
| /> | |
| </InputGroup> | |
| </div> | |
| <RestaurantList search={query} /> | |
| </Col> | |
| </Row> | |
| <style jsx> | |
| {` | |
| .search { | |
| margin: 20px; | |
| width: 500px; | |
| } | |
| `} | |
| </style> | |
| </div> | |
| ); | |
| } | |
| export default Home; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment