MainNav.js 822 Bytes
Newer Older
Kim, Subin's avatar
수빈    
Kim, Subin committed
1
2
import { useState } from "react";
import { useHistory } from "react-router";
Kim, Subin's avatar
Kim, Subin committed
3
import Search from "../Search";
4
5

const MainNav = () => {
Kim, Subin's avatar
Kim, Subin committed
6
    const [search, setSearch] = useState({ type: "home", keyword: "" })
Kim, Subin's avatar
수빈    
Kim, Subin committed
7
8
9
10
11
12
    const history = useHistory()

    function searchMovie() {
        history.push(`/search?title=${search.keyword}`)
    }

13
    return (
Jiwon Yoon's avatar
Jiwon Yoon committed
14
15
16
17
        <nav className="nav justify-content-evenly border border-start-0 border-end-0 border-white border-2 py-1">
            <a className="nav-link text-white" href="/movielist">영화</a>
            <a className="nav-link text-white" href="/ticket">빠른예매</a>
            <a className="nav-link text-white" href="/theater">극장</a>
Kim, Subin's avatar
Kim, Subin committed
18
            <Search search={search} setSearch={setSearch} handleClick={searchMovie} />
19
20
21
22
23
        </nav>
    )
}

export default MainNav