aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Header.js
blob: 6cf0784439bacd6c3e073faecbd0ada8db81ab6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { memo, useCallback } from 'react';
import { Link, useNavigate } from 'react-router-dom';

import SearchBox from './SearchBox';

function Header() {
    const navigate = useNavigate();
    /**
     * @param {string} searchString
     */
    let searchAll = useCallback((searchString) => {
        let location = {};
        location.pathname = '/discover';
        location.search = `?search=${searchString}`;
        navigate(location);
    }, [navigate]);
    return (
        <div id="header">
            <div id="header_wrapper">
                <div id="logo">
                    <Link to="/">Juick</Link>
                </div>
                <div id="search" className="desktop">
                    <SearchBox onSearch={searchAll} />
                </div>
            </div>
        </div>
    );
}

export default memo(Header);