Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix full width TextInput in Filter bug #5663

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/SearchInput.tsx
Expand Up @@ -12,7 +12,7 @@ import TextInput from './TextInput';
const useStyles = makeStyles(
{
input: {
marginTop: 32,
// marginTop: 32,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you comment this? Does not seem related to the issue. Besides, we don't keep commented out code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i removed this unrelated code changes now in latest commit

},
},
{ name: 'RaSearchInput' }
Expand Down
5 changes: 3 additions & 2 deletions packages/ra-ui-materialui/src/list/filter/FilterForm.tsx
Expand Up @@ -14,10 +14,11 @@ import { ClassesOverride } from '../../types';
const useStyles = makeStyles(
theme => ({
form: {
marginTop: -theme.spacing(2),
alignItems: 'center',
flexGrow: 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? Does not seem related to the issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i removed this unrelated code changes now in latest commit

Copy link
Member

Choose a reason for hiding this comment

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

no, it's still there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed alignItems:center property which was not related to this issue but flexGrow:1 is something which helped in fixing bug.

filterFormInput has a parent wrapper form tag in filterForm component and by applying style flexGrow:1 to form ,div tag (inside filterFormInput which is parent of filter text input) style width=100% property is effective and because of parent div can now take full-width,search text input could take up width=100% as well


paddingTop: 0,
display: 'flex',
alignItems: 'flex-end',
flexWrap: 'wrap',
minHeight: theme.spacing(10),
pointerEvents: 'none',
Expand Down
Expand Up @@ -15,6 +15,9 @@ const useStyles = makeStyles(
alignItems: 'flex-end',
pointerEvents: 'auto',
},
fullWidthBody: {
width: '100%',
},
spacer: { width: theme.spacing(2) },
hideButton: {},
}),
Expand All @@ -29,7 +32,11 @@ const FilterFormInput = props => {
return (
<div
data-source={filterElement.props.source}
className={classnames('filter-field', classes.body)}
className={classnames(
'filter-field',
classes.body,
filterElement.props.fullWidth && classes.fullWidthBody
)}
>
{!filterElement.props.alwaysOn && (
<IconButton
Expand Down