-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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
[Slider][Badge] Fix classes prop not working #24034
Conversation
@material-ui/core: parsed: +0.08% , gzip: +0.05% |
One issue I see is with the pseudo selectors: Another issue I found is, I am considering the vertical as a pseudo selector as well, I believe we should change the logic and check for the prop there, instead of applying the overrides under subselector, as So generally, is it good rule of thumb, to always use the props and apply some styles conditionally, unless the props are related to some global selector, like disabled, active etc.. cc @oliviertassinari Edit: I meant should we refactor this kinds of styles - https://github.com/mui-org/material-ui/pull/24034/files#diff-4bc6eb4ab21a45337e0ab1a81a8bda390122ca0d7b040b3f2a3d7ca0f24232d8R229-R232 -'&.MuiSlider-vertical' {}
+...(props.styleProps.vertical && {}), |
We should also probably add more tests, that the classes prop will be working as expected (currently we are testing only the utility classes as far as I could see |
@mnajdova What do you mean by override? Do you mean "we can't provide a custom class name" which would be a bug or "we can't override the CSS" which sounds expected.
It could have been better in the past to use |
Will fix the component to accept custom Let me then refactor the vertical slider with these changes and we can test that as well in the end |
packages/material-ui-unstyled/src/SliderUnstyled/SliderUnstyled.js
Outdated
Show resolved
Hide resolved
@@ -747,9 +757,8 @@ const SliderUnstyled = React.forwardRef(function SliderUnstyled(props, ref) { | |||
onMouseLeave={handleMouseLeave} | |||
{...thumbProps} | |||
className={clsx(utilityClasses.thumb, thumbProps.className, { | |||
[sliderUnstyledClasses['active']]: active === index, | |||
[sliderUnstyledClasses['disabled']]: disabled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already applied in the useSliderClasses
@oliviertassinari should we also merge this one mnajdova#20 for removing the usage of invisible classes selectors in the Badge component? |
No preferences |
@@ -40,7 +40,6 @@ const BadgeUnstyled = React.forwardRef(function BadgeUnstyled(props, ref) { | |||
vertical: 'top', | |||
horizontal: 'right', | |||
}, | |||
// eslint-disable-next-line @typescript-eslint/no-unused-vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a lint rule to disable eslint-disable for some rules? 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahahahha, nah it's just me :D
I'll merge it to have one PR complete all the necessary changes I found at this moment. If we receive another problem, we can revisit later again EDIT: WON'T MERGEReverted the changes, as this is how it was implemented in v4. |
badge invisible
…rovements Revert "badge invisible"
…najdova/material-ui into feat/slider-classes-prop-fixes
Fixes #24033