blob: 25757ed2f79aed03a804a16266ce2e41ceb3b8ce (
plain)
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
|
import React from 'react';
import { TextField, useTheme, useMediaQuery } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';
import { useTranslation } from '../../common/components/LocalizationProvider';
export const filterByKeyword = (keyword) => (item) => !keyword || JSON.stringify(item).toLowerCase().includes(keyword.toLowerCase());
const useStyles = makeStyles((theme) => ({
header: {
position: 'sticky',
left: 0,
display: 'flex',
flexDirection: 'column',
alignItems: 'stretch',
padding: theme.spacing(3, 2, 2),
},
}));
const SearchHeader = ({ keyword, setKeyword }) => {
const theme = useTheme();
const classes = useStyles();
const t = useTranslation();
const phone = useMediaQuery(theme.breakpoints.down('sm'));
return phone ? (
<div className={classes.header}>
<TextField
variant="outlined"
placeholder={t('sharedSearch')}
value={keyword}
onChange={(e) => setKeyword(e.target.value)}
/>
</div>
) : '';
};
export default SearchHeader;
|