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

MUI Grid Cleanup #2567

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open

MUI Grid Cleanup #2567

wants to merge 57 commits into from

Conversation

cammiida
Copy link
Contributor

@cammiida cammiida commented Oct 10, 2024

Description

Remove use of MUI Grid component and replace it with our own Flex component, as a part of the way to get rid of the dependency to material-ui.

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

@cammiida cammiida force-pushed the chore/mui-grid-cleanup branch 2 times, most recently from 8018960 to 38497c5 Compare October 11, 2024 12:20
Copy link

@cammiida cammiida self-assigned this Oct 14, 2024
@cammiida cammiida added kind/other Pull requests containing chores/repo structure/other changes quality/debt labels Oct 14, 2024
@paal2707
Copy link
Contributor

paal2707 commented Oct 21, 2024

Har du tatt i bruk designsystemet sine tokens her?
https://www.designsystemet.no/grunnleggende/designelementer/storrelser-og-avstander

*Edit: Dette gjøres senere

@cammiida cammiida force-pushed the chore/mui-grid-cleanup branch from 38497c5 to 38e755c Compare November 18, 2024 11:15
@cammiida cammiida force-pushed the chore/mui-grid-cleanup branch from 881d0bd to e44e282 Compare November 22, 2024 09:46
@paal2707 paal2707 self-assigned this Nov 29, 2024
@olemartinorg olemartinorg mentioned this pull request Jan 2, 2025
Copy link
Contributor

@olemartinorg olemartinorg left a comment

Choose a reason for hiding this comment

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

Solid piece of work! 🥳 Great job! 👏 🚀 The only thing I'm hesitant about is the breakpoints (see relevant comment), but otherwise this looks very good.

src/app-components/Date/DisplayDate.tsx Outdated Show resolved Hide resolved
Comment on lines +152 to +153
/* Small (sm breakpoint) */
@media (min-width: 600px) {
Copy link
Contributor

Choose a reason for hiding this comment

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

These breakpoints don't match what we've been using before (see the exported breakpoints from useDeviceWidths.ts). If you took the default values from MUI, remember that we're overriding the theme (see altinnApTheme.tsx, which also don't match the breakpoints in useDeviceWidths.ts 😕)

Copy link
Contributor

Choose a reason for hiding this comment

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

I had the correct breakpoints at first, but i got a diff from percy, and i changed it all back. I will look deeper into it! :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I see now that we need the current breakpoints as it is, because this corresponds with the MUI Grid component. They are equal to the overriding theme values(altinnApTheme.tsx ). I think that we should consider the changing the values of the spacing/breakpoints/etc to correspond with the designsystemet as a next iteration on the Flex component. Now the focus is to get rid of MUI without breaking changes.

src/app-components/Flex/Flex.tsx Outdated Show resolved Hide resolved
src/app-components/Number/DisplayNumber.tsx Outdated Show resolved Hide resolved
src/app-components/Text/DisplayText.tsx Outdated Show resolved Hide resolved
src/features/validation/ComponentValidations.tsx Outdated Show resolved Hide resolved
src/features/validation/ComponentValidations.tsx Outdated Show resolved Hide resolved
src/layout/Accordion/Accordion.module.css Outdated Show resolved Hide resolved
src/layout/Group/GroupSummary.tsx Show resolved Hide resolved
Comment on lines +106 to +112
size={{
xs: displayGrid?.xs ?? 12,
sm: displayGrid?.sm,
md: displayGrid?.md,
lg: displayGrid?.lg,
xl: displayGrid?.xl,
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't these do the same thing? 🤔

Suggested change
size={{
xs: displayGrid?.xs ?? 12,
sm: displayGrid?.sm,
md: displayGrid?.md,
lg: displayGrid?.lg,
xl: displayGrid?.xl,
}}
size={displayGrid}

Copy link
Contributor

Choose a reason for hiding this comment

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

No, the difference is that the fallback for xs on 12 is not applied.

Copy link
Contributor

Choose a reason for hiding this comment

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

So if you don't specify a size for xs, what does it do when you shrink it down? 🤔 I would imagine 12 is a good default.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you dont specify size for xs you dont get fluid sizing. This is the default behavior of MUI. it would still be 12 as a default but not fluid sizing. We could rewrite this to be default fluid 12, but it would require a rewrite css of many of our components. The priority in this PR is just to replicate what we already had. Many possibilities to improve our grid system now that we own it ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/other Pull requests containing chores/repo structure/other changes quality/debt
Projects
Status: 🔎 Review
Development

Successfully merging this pull request may close these issues.

3 participants