Skip to content

Changed TextField label font size to prevent overflowing parent #108

Merged
merged 3 commits into from
Nov 4, 2020

Conversation

wrigh393
Copy link
Collaborator

@wrigh393 wrigh393 commented Nov 2, 2020

No description provided.

Copy link
Collaborator

@campb303 campb303 left a comment

Choose a reason for hiding this comment

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

We cannot arbitrarily change font sizes, especially not as a fix for text appearance. Rather than making the text smaller, we should look for CSS solutions that allow for arbitrary text to be entered and appear properly. Consider using state and multiple props to display the text when the filter field is and is not active.

That aside, be sure to remove unnecessary spacing and unused imports. Whitespace doesn't affect functionality but it has significance for readability and should be treated with care. Unused imports throw eslint errors and create performance issues but loading and compiling code that is never used.

We'll need to address the comments before we can merge this change in.

@@ -1,19 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import { TextField } from "@material-ui/core";
import { TextField, makeStyles } from "@material-ui/core";
import { pink, purple } from '@material-ui/core/colors';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these colors needed? They've been imported but aren't used.


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

const useStyles = makeStyles({

Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove unnecessary spacing.

fontSize: 14,
},

},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Combine these block closers )};

);

const classes = useStyles();

return (
<>
Copy link
Collaborator

Choose a reason for hiding this comment

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

React fragments <> and </> are only needed if there is more than one root element being returned from a component. Because you're only using the TextField component here, you don't need fragments. Please remove them.

labelRoot: {
fontSize: 14,
},

Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove unnecessary spacing.

color="secondary"
type="search"
size="small"
variant="outlined"
fullWidth

Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove unnecessary spacing.

<TextField
label={label}
onChange={onChange}
classes={{ root: classes.inputLabelStyles }}
InputLabelProps={{
classes: { root: classes.labelRoot, focused: classes.labelFocused }}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

classes.labelFocused doesn't exist. Should it be created in useStyles() or removed from this classes prop?

const useStyles = makeStyles({

labelRoot: {
fontSize: 14,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't arbitrarily change font sizes. Its a nightmare for accessibility and constancy. We'll need a solution that scales with whatever content we put into the filter rows.

@campb303
Copy link
Collaborator

campb303 commented Nov 3, 2020

This is related to #105

Copy link
Collaborator

@campb303 campb303 left a comment

Choose a reason for hiding this comment

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

Be sure to remove unused imports.

@@ -1,37 +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.

@campb303 campb303 merged commit 4ae7083 into staging Nov 4, 2020
@campb303 campb303 deleted the bugfix-ItemTableFilter-label-overflow branch November 4, 2020 16:21
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants