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

[Joy] Miscellaneous fixes #31873

Merged
merged 39 commits into from
Mar 23, 2022
Merged

[Joy] Miscellaneous fixes #31873

merged 39 commits into from
Mar 23, 2022

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Mar 18, 2022

Found several issues from building Strapi design system in #30686.

Improvements

Render texts & links should be easy as possible (less sx as much as possible). See the use case in this Sandbox

I decided to add startDecorator & endDecorator prop to the Typography and Link which is very common use case. Also, create a TypographyContext to make the nested text alignment works well together.

Ex 1: to achieve this result, you can nest the Typography together
Screen Shot 2565-03-19 at 08 18 53

<Typography level="body2" color="text.primary">
  Ali Connors{' '}
  <Typography color="text.secondary"> // The typography knows how to adapt if it is a nested one
    {' '}
    — I&apos;ll be in your neighborhood doing errands this…
  </Typography>
</Typography>

Ex 2: the start & end decorator

Screen Shot 2565-03-19 at 08 23 16

<Typography>
  ... <Link startDecorator={<Icon />}>...</Link>
</Typography>

Fixes

  • TextField: pass type & name props to Input
  • Checkbox: pass id & name props to input, flex-shrink set to 0 in case it is used in flexbox
  • ListItemDecorator: able to set the color from the root List
  • ListItemButton: able to pass custom role
  • Button: remove unnecessary --Button-minHeight variable
  • List: remove the default background and integrated with Sheet, set nested inset to 0px (it is more common)
  • Avatar: add font-family body and adjust the fallback size
  • SvgIcon: add --Icon-color for customization.
  • Input, TextField: rename start/endAdornment to start/endDecorator.

@mui-bot
Copy link

mui-bot commented Mar 18, 2022

Details of bundle changes

@mui/joy: parsed: +2.17% , gzip: +1.17%

Generated by 🚫 dangerJS against a4d5684

@danilo-leal danilo-leal added the package: joy-ui Specific to @mui/joy label Mar 18, 2022
...theme.typography.body1,
fontFamily: theme.vars.fontFamily.body,
fontSize: theme.vars.fontSize.md,
lineHeight: 1,
Copy link
Member

Choose a reason for hiding this comment

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

Just double checking if this is intended. Shouldn't it be 1rem?

Copy link
Member Author

Choose a reason for hiding this comment

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

line-height: 1, means that it is equal to the font-size. I think it is better in this case because the button font-size can vary based on the size prop. The reason I use line-height 1 is that I can't find a better number otherwise you will see that the text is not aligned center inside the button. It is quite the same issue as in #30240

Copy link
Member

Choose a reason for hiding this comment

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

I see. Thanks for explaining!

...(ownerState.nested && {
display: 'inline-flex',
...(ownerState.startIcon && {
verticalAlign: 'bottom', // to make the text align with the parent's content
Copy link
Member

Choose a reason for hiding this comment

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

Just double checking. Is it intended that we have this property when ownerState.nested && ownerState.startIcon? Also, do we not need this when there is endIcon?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this is intended. There is no alignment issue if the icon is at the end. You can try to remove the verticalAlign to see the alignment issue. https://deploy-preview-31873--material-ui.netlify.app/experiments/joy/typography/

Screen Shot 2565-03-21 at 16 02 27

packages/mui-joy/src/Link/Link.tsx Outdated Show resolved Hide resolved
@siriwatknp siriwatknp requested a review from hbjORbj March 21, 2022 15:25
Copy link
Member

@hbjORbj hbjORbj left a comment

Choose a reason for hiding this comment

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

Looks great! 😁

Copy link
Contributor

@danilo-leal danilo-leal left a comment

Choose a reason for hiding this comment

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

Excellent work!

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 22, 2022
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 23, 2022
@siriwatknp siriwatknp merged commit d308623 into mui:master Mar 23, 2022
@hbjORbj hbjORbj mentioned this pull request Mar 25, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants