Skip to content

Commit

Permalink
Fixed filter label overflow using useState and javascript event liste…
Browse files Browse the repository at this point in the history
…ners
  • Loading branch information
Tyler Jordan Wright committed Nov 4, 2020
1 parent 1a4c22b commit 2221f28
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/components/ItemTableFilter/ItemTableFilter.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { TextField, makeStyles } from "@material-ui/core";
import { pink, purple } from '@material-ui/core/colors';
import { makeStyles, TextField } from "@material-ui/core";

export default function ItemTableFilter({ label, onChange }) {

const useStyles = makeStyles({

labelRoot: {
fontSize: 14,
overflow: "hidden"
},

},
);

labelFocused: {
overflow: "visible"
},
});
const classes = useStyles();

return (
<>
const [isFocused, setIsFocused] = useState(false);

return (
<TextField
label={label}
onChange={onChange}
classes={{ root: classes.inputLabelStyles }}
InputLabelProps={{
classes: { root: classes.labelRoot, focused: classes.labelFocused }}}
onFocus={() => setIsFocused(true)}
onBlur={() => setIsFocused(false)}
className={ isFocused ? classes.labelFocused : classes.labelRoot }
color="secondary"
type="search"
size="small"
variant="outlined"

/>
</>
);

};
Expand Down

0 comments on commit 2221f28

Please sign in to comment.