Skip to content

[material-next][ButtonGroup] Add ButtonGroup component with Material You design #39699

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

Closed
wants to merge 35 commits into from

Conversation

lhilgert9
Copy link
Contributor

@lhilgert9 lhilgert9 commented Nov 1, 2023

ButtonGroup issue: #39686
Material You umbrella issue: #29345

Changes

Preview: https://deploy-preview-39699--material-ui.netlify.app/material-ui/react-button-group/#material-you-version

Add Slider component implementing Material You style specifications:

Known Issues

  • when variant is set to "filledTonal" or "elevated" the color is changing to "primary", but this is a bug in the Button component

@mui-bot
Copy link

mui-bot commented Nov 1, 2023

Netlify deploy preview

@mui/material-next: parsed: +1.39% , gzip: +0.95%

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 98f9485

@lhilgert9 lhilgert9 marked this pull request as draft November 1, 2023 14:34
@mj12albert
Copy link
Member

@lhilgert9 I would suggest you separate the first 3 commits here into a separate PR that we can merge first, so that the diffs in this one (with the actual code changes) are not all green and easier to review 🙏

Example: #39635

@lhilgert9
Copy link
Contributor Author

@lhilgert9 I would suggest you separate the first 3 commits here into a separate PR that we can merge first, so that the diffs in this one (with the actual code changes) are not all green and easier to review 🙏

Example: #39635

@mj12albert I split the PR as you suggested. The copying of the files, as well as fixing the import errors are now in PR #39716.

@danilo-leal danilo-leal added package: material-ui Specific to @mui/material component: ButtonGroup The React component. v6.x labels Nov 2, 2023
@lhilgert9 lhilgert9 changed the title [ButtonGroup][material-next] Add ButtonGroup component with Material You design [material-next][ButtonGroup] Add ButtonGroup component with Material You design Nov 2, 2023
@lhilgert9 lhilgert9 marked this pull request as ready for review November 2, 2023 21:37
@lhilgert9
Copy link
Contributor Author

lhilgert9 commented Nov 2, 2023

@mj12albert @DiegoAndai I have fixed the most issues, but there are still two tests not working.

  1. I have no idea why argos is failing, because the screenshot that is displayed as faulty was not edited by me and has nothing to do with the commits.
  2. The test unit fail looks like there is an error inside the CssVarProvider which is caused by jsdom, so I would recommend implementing
if (/jsdom/.test(window.navigator.userAgent)) {
    this.skip();
}

for the test that fails. Alternatively, we could implement something like mentioned here: https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom.

What are your thougts on this?

Since all other errors have been corrected, I would suggest continuing to work in this PR and closing the PR #39716.

@mj12albert
Copy link
Member

but there are still two tests not working.

Don't worry about the argos one for now, sometimes it's quite flaky!

import ButtonGroupContext from './ButtonGroupContext';
import { CssVarsProvider, extendTheme } from '../styles';

describe('<ButtonGroup />', () => {
Copy link
Member

@mj12albert mj12albert Nov 3, 2023

Choose a reason for hiding this comment

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

To fix the unit test, you need to kind of mock window.matchMedia like this

And as part of this, the test should be converted to TS as well ~

@lhilgert9
Copy link
Contributor Author

@mj12albert Okay that helped. I have fixed all the error and I think now its done.
My suggestion would be to think about how best to split this PR into several small PRs so that they can better reviewed and iterated, as we tried to do with #39716. However, I would suggest closing #39716 and starting from scratch with splitting it up.

@lhilgert9 lhilgert9 requested a review from mj12albert November 3, 2023 08:53
@mj12albert
Copy link
Member

However, I would suggest closing #39716 and starting from scratch with splitting it up.

@lhilgert9 That works too ~ it may be easier to ensure that the changes from #38520 are incorporated from the beginning!

@lhilgert9
Copy link
Contributor Author

lhilgert9 commented Nov 3, 2023

@lhilgert9 That works too ~ it may be easier to ensure that the changes from #38520 are incorporated from the beginning!

@mj12albert the changes in #38520 are included in both #39716 and this one. I just thought it would be easier to create new PRs now, because I now know what changes I have to make one after the other so that no errors occur in the individual PRs.

@lhilgert9
Copy link
Contributor Author

lhilgert9 commented Nov 3, 2023

@mj12albert @DiegoAndai
I would suggest the following split PRs:

  • Copy files to next-material and implement ButtonGroupContext in material-nextButton
  • Change all files to TS
  • Implement MD3 style
  • Add playground to the docs

Let me know if you have any other suggestions. Otherwise, please give me the go ahead to close #39716 and start with these PRs I suggested.

@DiegoAndai
Copy link
Member

@lhilgert9 that sounds good 🙌🏼 go ahead and close #39716

@lhilgert9
Copy link
Contributor Author

Close this PR in favor of

  • Copy files to next-material and implement ButtonGroupContext in material-nextButton
  • Change all files to TS
  • Implement MD3 style
  • Add playground to the docs

@lhilgert9 lhilgert9 closed this Nov 7, 2023
@DiegoAndai DiegoAndai added v7.x and removed v6.x labels Dec 26, 2023
@lhilgert9 lhilgert9 deleted the material-you-button-group branch April 2, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ButtonGroup The React component. package: material-ui Specific to @mui/material v7.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants