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

[docs] Fix experimental API page duplication #35213

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Customization
# CSS theme variables - Customization

<p class="description">A guide for customizing CSS theme variables in Material UI.</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Migrating to CSS variables
# Migrating to CSS theme variables

<p class="description">A step-by-step migration guide to start using CSS theme variables in your project.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ For server-side applications, there are some trade-offs to consider:

| | Compare to the default method | Reason |
| ---------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------ |
| HTML size | bigger | CSS variables are generated for both light and dark mode at build time. |
| [First Contentful Paint (FCP)](https://web.dev/fcp/) | larger | Since the HTML size is generally bigger, the time to download the HTML before showing the content is longer. |
| HTML size | Bigger | CSS variables are generated for both light and dark mode at build time. |
| [First Contentful Paint (FCP)](https://web.dev/fcp/) | Larger | Since the HTML size is generally bigger, the time to download the HTML before showing the content is longer. |
| [Time to Interactive (TTI)](https://web.dev/tti/) | Smaller (for dark mode) | Stylesheets are not regenerated between light and dark mode, so it takes less time for JavaScript to run. |

:::warning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Usage
# CSS theme variables - Usage

<p class="description">Learn how to use the experimental APIs to adopt CSS theme variables.</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CSS variables
# TODO merge with other pages
Copy link
Member

Choose a reason for hiding this comment

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

@oliviertassinari I see this in https://mui.com/material-ui/experimental-api/css-variables/. I think your intent was to add a comment here. As for the fix, should we remove this page or keep the heading as CSS variables?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that the next step is to merge the two pages. https://mui.com/material-ui/experimental-api/css-variables/ is superior in a couple of ways:

  1. it has an API reference page. https://mui.com/material-ui/experimental-api/css-variables/#api, e.g. it's the only search result for disableTransitionOnChange
Screenshot 2023-05-23 at 16 56 48
  1. it has two demos while there is not a single demo on the new pages. I would have expected many simple demos. So developers can play with it and understand what it does.


<p class="description">Learn about the experimental API for using CSS variables with Material UI components.</p>

Expand Down
6 changes: 5 additions & 1 deletion docs/data/material/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ const pages: MuiPage[] = [
{ pathname: '/material-ui/experimental-api/css-theme-variables/customization' },
{
pathname: '/material-ui/experimental-api/css-theme-variables/migration',
title: 'Migrating to CSS theme variables',
title: 'Migrating to CSS variables',
},
{
pathname: '/material-ui/experimental-api/css-variables',
title: 'TODO merge with other pages',
},
],
},
Expand Down
7 changes: 0 additions & 7 deletions docs/pages/experimental-api/classname-generator.js

This file was deleted.

7 changes: 0 additions & 7 deletions docs/pages/experimental-api/css-variables.js

This file was deleted.

18 changes: 14 additions & 4 deletions docs/public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -378,18 +378,28 @@ https://v4.material-ui.com/* https://v4.mui.com/:splat 301!
/:lang/joy-ui/core-features/global-variant/ /:langjoy-ui/main-features/global-variants/ 301
/joy-ui/core-features/automatic-adjustment/ /joy-ui/main-features/automatic-adjustment/ 301
/:lang/joy-ui/core-features/automatic-adjustment/ /:lang/joy-ui/main-features/automatic-adjustment/ 301
/joy-ui/core-features/perfect-dark-mode/ /joy-ui/main-features/perfect-dark-mode/ 301
/:lang/joy-ui/core-features/perfect-dark-mode/ /:lang/joy-ui/main-features/perfect-dark-mode/ 301
Comment on lines -381 to -382
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a double redirection. it was added in https://github.com/mui/material-ui/pull/34613/files#diff-7a0cbac74402caf0e99ba338a9e7c42684580a1f85e149110c3c2ca6e38055afR390 @samuelsycamore A tip, when adding a new redirection, it's a good practice to also update the redirections that might already point to the new "old URL". It avoids a double 301.

/joy-ui/core-features/perfect-dark-mode/ /joy-ui/main-features/dark-mode-optimization/ 301
/:lang/joy-ui/core-features/perfect-dark-mode/ /:lang/joy-ui/main-features/dark-mode-optimization/ 301
/system/basics/ /system/getting-started/overview/ 301
/:lang/system/basics/ /:lang/system/getting-started/overview/ 301
/system/the-sx-prop/ /system/getting-started/the-sx-prop/ 301
/:lang/system/the-sx-prop/ /:lang/system/getting-started/the-sx-prop/ 301
/system/advanced/ /system/getting-started/custom-components/ 301
/:lang/base/react-trap-focus/ /:lang/base/react-focus-trap/ 301
/:lang/base/api/trap-focus/ /:lang/base/api/focus-trap/ 301
/:lang/system/advanced/ /:lang/system/getting-started/custom-components/ 301
/base/react-trap-focus/ /base/react-focus-trap/ 301
/:lang/base/react-trap-focus/ /:lang/base/react-focus-trap/ 301
/base/api/trap-focus/ /base/api/focus-trap/ 301
/:lang/base/api/trap-focus/ /:lang/base/api/focus-trap/ 301
/material-ui/experimental-api/css-variables/ /material-ui/experimental-api/css-theme-variables/overview/ 301
/:lang/material-ui/experimental-api/css-variables/ /:lang/material-ui/experimental-api/css-theme-variables/overview/ 301
/joy-ui/main-features/perfect-dark-mode/ /joy-ui/main-features/dark-mode-optimization/ 301
/:lang/joy-ui/main-features/perfect-dark-mode/ /:lang/joy-ui/main-features/dark-mode-optimization/ 301
/joy-ui/guides/applying-dark-mode/ /joy-ui/customization/dark-mode/ 301
/:lang/joy-ui/guides/applying-dark-mode/ /:lang/joy-ui/customization/dark-mode/ 301
Comment on lines 397 to +398
Copy link
Member Author

Choose a reason for hiding this comment

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

Redirecting the en-US locale isn't enough.

Once we stop this generation of pt, zh pages, we will be able to not have /:lang/ for the redirection of pages first introduced after the generation stopped. So, it's not for tomorrow.

/experimental-api/classname-generator/ /material-ui/experimental-api/classname-generator/ 301
/:lang/experimental-api/classname-generator/ /:lang/material-ui/experimental-api/classname-generator/ 301
/experimental-api/css-variables/ /material-ui/experimental-api/css-theme-variables/overview/ 301
/:lang/experimental-api/css-variables/ /:lang/material-ui/experimental-api/css-theme-variables/overview/ 301
# 2023

# Proxies
Expand Down
9 changes: 0 additions & 9 deletions docs/src/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,6 @@ const pages: readonly MuiPage[] = [
{ pathname: '/guides/flow' },
],
},
Comment on lines 280 to 282
Copy link
Member Author

Choose a reason for hiding this comment

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

I was tempted to remove all the rest, but I didn't to keep this PR relatively small.

{
pathname: '/experimental-api',
title: 'Experimental APIs',
icon: 'ExperimentIcon',
children: [
{ pathname: '/experimental-api/classname-generator', title: 'ClassName generator' },
{ pathname: '/experimental-api/css-variables', title: 'CSS variables' },
],
},
{
pathname: '/styles',
title: 'Styles',
Expand Down
3 changes: 2 additions & 1 deletion docs/translations/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@
"/material-ui/experimental-api/css-theme-variables/overview": "Overview",
"/material-ui/experimental-api/css-theme-variables/usage": "Usage",
"/material-ui/experimental-api/css-theme-variables/customization": "Customization",
"/material-ui/experimental-api/css-theme-variables/migration": "Migrating to CSS theme variables",
"/material-ui/experimental-api/css-theme-variables/migration": "Migrating to CSS variables",
"/material-ui/experimental-api/css-variables": "TODO merge with other pages",
"/material-ui/discover-more": "Discover more",
"/material-ui/discover-more/showcase": "Showcase",
"/material-ui/discover-more/related-projects": "Related projects",
Expand Down