MainNav.js 797 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
7
8
9
10
11
12
    const [search, setSearch] = useState({ keyword: "" })
    const history = useHistory()

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

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

export default MainNav