SearchInput.js
1.17 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
47
48
49
50
51
52
53
54
55
56
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/styles';
import { Paper, Input } from '@material-ui/core';
import SearchIcon from '@material-ui/icons/Search';
const useStyles = makeStyles(theme => ({
root: {
borderRadius: '4px',
alignItems: 'center',
padding: theme.spacing(1),
display: 'flex',
flexBasis: 420
},
icon: {
marginRight: theme.spacing(1),
color: theme.palette.text.secondary
},
input: {
flexGrow: 1,
fontSize: '14px',
lineHeight: '16px',
letterSpacing: '-0.05px'
}
}));
const SearchInput = props => {
const { className, onChange, style, ...rest } = props;
const classes = useStyles();
return (
<Paper
{...rest}
className={clsx(classes.root, className)}
style={style}
>
<SearchIcon className={classes.icon} />
<Input
{...rest}
className={classes.input}
disableUnderline
onChange={onChange}
/>
</Paper>
);
};
SearchInput.propTypes = {
className: PropTypes.string,
onChange: PropTypes.func,
style: PropTypes.object
};
export default SearchInput;