MainNav.js 845 Bytes
Newer Older
Kim, Subin's avatar
수빈    
Kim, Subin committed
1
import { useState } from "react";
Kim, Subin's avatar
Kim, Subin committed
2
3
import { Link, useHistory } from "react-router-dom";

Kim, Subin's avatar
Kim, Subin committed
4
import Search from "../Search";
5
6

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

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

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

export default MainNav