Skip to content

Commit

Permalink
Merge pull request #108 from ECN/bugfix-ItemTableFilter-label-overflow
Browse files Browse the repository at this point in the history
Changed TextField label font size to prevent overflowing parent
  • Loading branch information
campb303 authored Nov 4, 2020
2 parents fb4b2e1 + 9ebecc8 commit 4ae7083
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/components/ItemTableFilter/ItemTableFilter.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
import React from 'react';
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { TextField } from "@material-ui/core";
import { makeStyles, TextField } from "@material-ui/core";

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

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

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

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

};
Expand Down

0 comments on commit 4ae7083

Please sign in to comment.