[dfd5d87] | 1 | import React, { Component } from 'react'
|
---|
| 2 | import { styled, alpha } from '@mui/material/styles';
|
---|
| 3 | import "./SearchFieldComponent.css"
|
---|
| 4 | import AppBar from '@mui/material/AppBar';
|
---|
| 5 | import Box from '@mui/material/Box';
|
---|
| 6 | import Toolbar from '@mui/material/Toolbar';
|
---|
| 7 | import IconButton from '@mui/material/IconButton';
|
---|
| 8 | import Typography from '@mui/material/Typography';
|
---|
| 9 | import InputBase from '@mui/material/InputBase';
|
---|
| 10 | import Badge from '@mui/material/Badge';
|
---|
| 11 | import MenuItem from '@mui/material/MenuItem';
|
---|
| 12 | import Menu from '@mui/material/Menu';
|
---|
| 13 | import MenuIcon from '@mui/icons-material/Menu';
|
---|
| 14 | import SearchIcon from '@mui/icons-material/Search';
|
---|
| 15 | import AccountCircle from '@mui/icons-material/AccountCircle';
|
---|
| 16 | import MailIcon from '@mui/icons-material/Mail';
|
---|
| 17 | import NotificationsIcon from '@mui/icons-material/Notifications';
|
---|
| 18 | import MoreIcon from '@mui/icons-material/MoreVert';
|
---|
| 19 |
|
---|
| 20 | const Search = styled('div')(({ theme }) => ({
|
---|
| 21 | position: 'relative',
|
---|
| 22 | borderRadius: theme.shape.borderRadius,
|
---|
| 23 | backgroundColor: alpha(theme.palette.common.white, 0.15),
|
---|
| 24 | '&:hover': {
|
---|
| 25 | backgroundColor: alpha(theme.palette.common.white, 0.25),
|
---|
| 26 | },
|
---|
| 27 | marginRight: theme.spacing(2),
|
---|
| 28 | marginLeft: 0,
|
---|
| 29 | width: '100%',
|
---|
| 30 | [theme.breakpoints.up('sm')]: {
|
---|
| 31 | marginLeft: theme.spacing(3),
|
---|
| 32 | width: 'auto',
|
---|
| 33 | },
|
---|
| 34 | }));
|
---|
| 35 |
|
---|
| 36 | const SearchIconWrapper = styled('div')(({ theme }) => ({
|
---|
| 37 | padding: theme.spacing(0, 2),
|
---|
| 38 | height: '100%',
|
---|
| 39 | position: 'absolute',
|
---|
| 40 | pointerEvents: 'none',
|
---|
| 41 | display: 'flex',
|
---|
| 42 | alignItems: 'center',
|
---|
| 43 | justifyContent: 'center',
|
---|
| 44 | }));
|
---|
| 45 |
|
---|
| 46 | const StyledInputBase = styled(InputBase)(({ theme }) => ({
|
---|
| 47 | color: 'inherit',
|
---|
| 48 | '& .MuiInputBase-input': {
|
---|
| 49 | padding: theme.spacing(1, 1, 1, 0),
|
---|
| 50 | // vertical padding + font size from searchIcon
|
---|
| 51 | paddingLeft: `calc(1em + ${theme.spacing(4)})`,
|
---|
| 52 | transition: theme.transitions.create('width'),
|
---|
| 53 | width: '100%',
|
---|
| 54 | [theme.breakpoints.up('md')]: {
|
---|
| 55 | width: '20ch',
|
---|
| 56 | },
|
---|
| 57 | },
|
---|
| 58 | }));
|
---|
| 59 |
|
---|
| 60 | export default class SearchFieldComponent extends Component {
|
---|
[dbd4834] | 61 | constructor(props) {
|
---|
| 62 | super(props)
|
---|
| 63 |
|
---|
| 64 | this.state = {
|
---|
| 65 |
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | handleChange = (event) => {
|
---|
| 70 | this.props.changeHandler({searchValue: event.target.value})
|
---|
| 71 | }
|
---|
| 72 |
|
---|
[dfd5d87] | 73 | render() {
|
---|
| 74 | return (
|
---|
[dbd4834] | 75 | <Search onChange={this.handleChange} className="search-phone-field">
|
---|
[dfd5d87] | 76 | <SearchIconWrapper id="iconwrapper">
|
---|
| 77 | <SearchIcon />
|
---|
| 78 | </SearchIconWrapper>
|
---|
| 79 | <StyledInputBase
|
---|
[dbd4834] | 80 | className="search-phone-input"
|
---|
[dfd5d87] | 81 | placeholder="Пребарувај…"
|
---|
| 82 | inputProps={{ 'aria-label': 'search' }}
|
---|
[dbd4834] | 83 | />
|
---|
[dfd5d87] | 84 | </Search>
|
---|
| 85 | )
|
---|
| 86 | }
|
---|
| 87 | }
|
---|