forked from box/box-ui-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeader.js.flow
More file actions
46 lines (41 loc) · 1.3 KB
/
Header.js.flow
File metadata and controls
46 lines (41 loc) · 1.3 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as React from 'react';
import { useIntl } from 'react-intl';
import { SearchInput } from '@box/blueprint-web';
import Logo from './Logo';
import messages from '../messages';
import { VIEW_FOLDER, VIEW_SEARCH } from '../../../constants';
import type { View } from '../../../common/types/core';
import './Header.scss';
type HeaderProps = {
isHeaderLogoVisible?: boolean,
logoUrl?: string,
onSearch: any,
view: View
};
const Header = ({
isHeaderLogoVisible = true,
view,
onSearch,
logoUrl,
}: HeaderProps) => {
const { formatMessage } = useIntl();
const searchMessage = formatMessage(messages.searchPlaceholder);
const isFolder = view === VIEW_FOLDER;
const isSearch = view === VIEW_SEARCH;
return (
<div className="be-header">
{isHeaderLogoVisible && <Logo url={logoUrl} />}
<div className="be-search">
<SearchInput
disabled={!isFolder && !isSearch}
onChange={onSearch}
placeholder={searchMessage}
searchInputAriaLabel={searchMessage}
searchInputClearAriaLabel={formatMessage(messages.searchClear)}
variant="global"
/>
</div>
</div>
);
};
export default Header;