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

[Radio][Joy] support componentsProps as a function #34022

Merged
merged 7 commits into from Aug 25, 2022

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Aug 21, 2022

  • follows the MUI Base componentsProps pattern (support callback) which remove the need for classes to style between states.
  • update typings
  • update demos to use the callback

Before:

<Radio sx={theme => ({
  [`&.${radioClasses.checked}`]: {
    [`& .${radioClasses.action}]: { ... }
  }
}) />

After:

<Radio componentsProps={{
  action: ({ checked }) => ({
    sx: theme => ({
      ...checked && { ... }
    })
  })
}} />

@siriwatknp siriwatknp added docs Improvements or additions to the documentation package: joy-ui Specific to @mui/joy labels Aug 21, 2022
@mui-bot
Copy link

mui-bot commented Aug 21, 2022

Details of bundle changes

Generated by 🚫 dangerJS against 4082f54

@siriwatknp
Copy link
Member Author

siriwatknp commented Aug 22, 2022

@michaldudak If the changes look good, I will apply them to all of the Joy components in a separate PR.

Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

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

The implementation looks good! It's much cleaner now.
I found just some wording to correct, the rest seems good!

@@ -1,45 +1,47 @@
import { generateUtilityClass, generateUtilityClasses } from '../className';

export interface RadioClasses {
/** Styles applied to the root element. */
/** Classname applied to the root element. */
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/** Classname applied to the root element. */
/** Class name applied to the root element. */
  • all the lines below

@siriwatknp siriwatknp merged commit df89184 into mui:master Aug 25, 2022
daniel-rabe pushed a commit to daniel-rabe/material-ui that referenced this pull request Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants