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

feat(input): full width on low screen resolution #8797

Conversation

soullivaneuh
Copy link
Contributor

Summary

closes #8795

@soullivaneuh
Copy link
Contributor Author

soullivaneuh commented Apr 3, 2023

I am not sure about what fix to provide for the typecheck issue.

May you give me a hint?

I followed that documentation: https://mui.com/material-ui/customization/theme-components/#theme-style-overrides

@slax57
Copy link
Contributor

slax57 commented Apr 4, 2023

I am not sure about what fix to provide for the typecheck issue.

May you give me a hint?

I followed that documentation: https://mui.com/material-ui/customization/theme-components/#theme-style-overrides

It's odd, but it seems that, although this syntax is documented, MUI is not willing to support it in the long term and hence not willing to support it in the TS types (source: mui/material-ui#29319)

You might have to find another way to do this...

@soullivaneuh
Copy link
Contributor Author

@slax57 Thanks!

That is quite a bad news because the other found I started to get into was to add the fullWidth property logic in each input component, which will lead to a maintenance nightmare in my opinion.

According to that comment, we may be able to achieve our needs using theme.components[Component].variants. I'll dig onto that.

@soullivaneuh soullivaneuh force-pushed the input-full-width-small-resolution branch from 5e46989 to 527eeaa Compare April 4, 2023 19:19
@soullivaneuh
Copy link
Contributor Author

I got that fixed using variants! 🎉

As the usage of styleOverrides looks not recommended for the future, I also took the initiative to migrate the existing on a separated commit: b217bb6

Comment on lines +39 to +49
variants: [
{
props: {},
style: {
backgroundColor: 'rgba(0, 0, 0, 0.04)',
'&$disabled': {
backgroundColor: 'rgba(0, 0, 0, 0.04)',
},
},
},
},
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why you needed to change these lines too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please see: #8797 (comment)

As the usage of styleOverrides looks not recommended for the future, I also took the initiative to migrate the existing on a separated commit: b217bb6

If you prefer to keep the change to the target, I can simply drop this commit. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see. Actually my understanding is that it's only the API for supporting callback in styleOverrides which may not be supported long term, but not the whole styleOverrides feature.
So IMO there's no need to change that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is something not needed currently but may be needed if we want dynamic styling as I did for the rest later.

As using style handles both cases (static and dynamic), transforming it make it ready for.

If you still disagree with my opinion, please let me know and I will confirm by removing the commit.

@fzaninotto
Copy link
Member

This PR doesn't fix the aforementioned problem, see the deployed storybook https://react-admin-storybook-jxzza3gyv-marmelab.vercel.app/?path=/story/ra-ui-materialui-list-list--filters

image

@fzaninotto
Copy link
Member

No news for some time, closing.

@fzaninotto fzaninotto closed this Aug 9, 2023
@fzaninotto
Copy link
Member

Superseded by #9169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the filter inputs full width by default on low screen resolution (mobile)
3 participants