Skip to content
Snippets Groups Projects
Commit d2c2af1c authored by lfr20's avatar lfr20
Browse files

Added icons to seacrh and clean input

parent b7b54560
No related branches found
No related tags found
6 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!39Update admin system,!32Homologa,!31Fix console error,!28Training materials
...@@ -5,6 +5,8 @@ import IconButton from '@material-ui/core/IconButton'; ...@@ -5,6 +5,8 @@ import IconButton from '@material-ui/core/IconButton';
import OutlinedInput from '@material-ui/core/OutlinedInput'; import OutlinedInput from '@material-ui/core/OutlinedInput';
import InputAdornment from '@material-ui/core/InputAdornment'; import InputAdornment from '@material-ui/core/InputAdornment';
import FormControl from '@material-ui/core/FormControl'; import FormControl from '@material-ui/core/FormControl';
import Divider from '@material-ui/core/Divider';
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
export default function SearchInput(props) { export default function SearchInput(props) {
const [text, setText] = useState(props.stdin); const [text, setText] = useState(props.stdin);
...@@ -17,31 +19,56 @@ export default function SearchInput(props) { ...@@ -17,31 +19,56 @@ export default function SearchInput(props) {
props.search(text); props.search(text);
} }
const handleCleanInput = () => {
setText("");
}
const handleKeyUp = (event) => {
if (event.key === "Enter")
handleClickSearch()
}
return ( return (
<Wrapper> <Wrapper>
<FormControl variant="outlined" style={{width: '100%'}}> <FormControl variant="outlined" style={{ width: '100%' }}>
<OutlinedInput <OutlinedInput
type="text" type="text"
value={text} value={text}
placeholder="O quê você está buscando?"
onChange={handleChange} onChange={handleChange}
onKeyUp={handleKeyUp}
endAdornment={ endAdornment={
<InputAdornment position="end"> <>
<IconButton <InputAdornment position="end">
onClick={handleClickSearch} <IconButton
edge="end" onClick={handleCleanInput}
> edge="end"
<SearchIcon /> >
</IconButton> <CloseRoundedIcon />
</InputAdornment> </IconButton>
</InputAdornment>
<SizedWidhtBox />
<Divider orientation="vertical" flexItem />
<InputAdornment position="end">
<IconButton
onClick={handleClickSearch}
edge="end"
>
<SearchIcon style={{ fill: "#00bcd4" }} />
</IconButton>
</InputAdornment>
</>
} }
/> />
</FormControl> </FormControl>
</Wrapper> </Wrapper>
); );
} }
const Wrapper=styled.div` const Wrapper = styled.div`
background-color: white; background-color: white;
border-radius: 5px; border-radius: 5px;
margin: 20px; margin: 20px;
`
const SizedWidhtBox = styled.div`
margin-right : 22px;
` `
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment