Skip to content

Changed TextField label font size to prevent overflowing parent #108

Merged
merged 3 commits into from
Nov 4, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, { useEffect, useState } from 'react';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useEffect is not used in this component and should be removed.

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