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

[code-infra] Move the HighlightedCode component to @mui/docs #41859

Merged
merged 13 commits into from
Apr 19, 2024

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Apr 11, 2024

https://www.notion.so/mui-org/base-ui-Stable-release-outline-3f2197f1885747bdb3f384b30697a337
Moving components to @mui/docs:

  • MarkdownElement
  • HighlightedCode
  • CopyButton and related context/hooks

@mui-bot
Copy link

mui-bot commented Apr 11, 2024

Netlify deploy preview

https://deploy-preview-41859--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 19d7243

@Janpot Janpot added docs Improvements or additions to the documentation scope: code-infra Specific to the core-infra product labels Apr 11, 2024
@Janpot Janpot marked this pull request as ready for review April 11, 2024 16:05
@Janpot Janpot requested review from a team April 11, 2024 16:05
@danilo-leal danilo-leal changed the title Move HighlightedCode to @mui/docs [code-infra] Move the HighlightedCode component to @mui/docs Apr 11, 2024
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

Looks good. The X migration should not be an issue: mui/mui-x#12757

@bharatkashyap Just a heads up since this PR could interfere with your #40901 by moving the MarkdownElement

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 12, 2024
@bharatkashyap
Copy link
Member

@bharatkashyap Just a heads up since this PR could interfere with your #40901 by moving the MarkdownElement

Yes, I noticed that. I can resolve conflicts once this is merged

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 12, 2024
@alexfauquette
Copy link
Member

I added a commit to add diff from #39603 the PR I merged before reviewing this one

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 15, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 18, 2024
@Janpot Janpot enabled auto-merge (squash) April 19, 2024 09:16
@Janpot Janpot merged commit 6577056 into mui:next Apr 19, 2024
21 checks passed
@mnajdova
Copy link
Member

@Janpot there are two MarkdownElement component in the repository, some wrong imports were changed (@danilo-leal is fixing this in #42011, so we are good on core side). Have you checked which imports were the X and Toolpad repo using before? Just making sure we didn't move the wrong component. I advised @danilo-leal to rename the other component, but it would be great to check this before the change propagates everywhere. The components in question are:

@alexfauquette
Copy link
Member

On the X side, we have import MarkdownElement from 'docs/src/modules/components/MarkdownElement'; so for us, it should be ok

@danilo-leal
Copy link
Contributor

danilo-leal commented Apr 24, 2024

Heads-up on that: on my PR that Marija linked above, I'm changing this component's name to MarketingMarkdownElement. After this PR, there was no other component using the MarkdownElement component coming from the src/components/markdown directory in the Material UI repo, so I figured it'd be better to scope it down to marketing pages only. So, if there's anywhere in the MUI X repo that uses that one, it might be better to use the component coming from the @mui/docs package? I'll look it up to see what are the use cases.

@alexfauquette
Copy link
Member

Yes, as soon as the core do a release, I will update the X repo to get the latest @mui/docs

@Janpot
Copy link
Member Author

Janpot commented Apr 24, 2024

I'm removing the one that I found in Toolpad.
Just in terms of abstraction, why do we need two of these? Do they do different things? i.e. why does marketing need a different markdownelement?

@danilo-leal
Copy link
Contributor

Uhm, yeah. There might be a better way to structure the HighlightedCode component so that all the specific/different styling things I'd like to apply on the pre element for the marketing showcase sections (such as no border, padding, margin, and smaller font-size), are directly added from that component, instead of being passed through another one?

@Janpot
Copy link
Member Author

Janpot commented Apr 24, 2024

I think the main thing that I found not ergonomic is the height + overflow + border radius. It also feels like the wrong element is the scroll container

  • Some use cases need auto-height, size with the content
  • Some need a fixed or max height + overflow
    • Some of these are use directly and need their corners clipped + nice borders
    • Others are used in e.g. tabs, or demo container that comes with its own border + clipping

Corners fighting with scrollbars 🙂

Screenshot 2024-04-24 at 16 43 37

@mnajdova
Copy link
Member

I propose we go step by step:

  1. Fix only the wrong imports in MUI Core in one PR, we can with this track back the changes later if needed - this should only fix the regression in Core
  2. Add more props in the MarkdownElement to support the use-cases we need on the marketing pages - as a non-breaking change, so that other products don't need to do anything and remove the duplicated component
  3. Improve the component later - namely the things Jan mentioned above

@danilo-leal
Copy link
Contributor

That makes sense! In the meantime, I recorded this quick Loom just to walk through what I was thinking as a solution to remove the MarketingMarkdownElement component I'm introducing in that website fix PR of mine (#42011).

We don't need to tackle it immediately, but if this makes sense, I'm happy to do it! It's also not tackling the stuff you mentioned @Janpot just yet. It's just a way to consolidate custom pre styling into the HighlightedCode component.

@mnajdova
Copy link
Member

@danilo-leal that makes sense, I would suggest renaming the prop to plain to explain more the difference, as we may use this in other places in the future too. Let's move the discussion to the other relevant PR, as we seem to agree on what needs to be done :)

@Janpot
Copy link
Member Author

Janpot commented Apr 24, 2024

For the record, I'm just pointing out some rough edges I ran into when integrating HighlightedCode. These are not blockers or urgent changes. I just wanted to share.
Thanks for addressing the regression I introduced in @mui/docs. Fixing this has priority.

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 scope: code-infra Specific to the core-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants