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

feat: doc-layout components merge classes from props #1618

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ap0nia
Copy link
Contributor

@ap0nia ap0nia commented Nov 21, 2024

Summary

Refactored the default MDX components used by DocLayout to properly merge the className with the component's default className.

Added a new "tailwind" utility, clsx which basically merges string (classNames). Does not depend on any external libraries.

Notes

All changes should be entirely non-breaking because the user needs to opt-in to adding classNames to the HTML elements. Additionally, very little was changed for each component.

The one exception would be the Pre component. In order to properly merge className intended for the parent and children, the wrapping div with className="language-bash" was lifted up outside renderChildren. And renderChildren was moved to module level. It looks functionally the same, but I have not confirmed it yet...

TODO

Fix tests...

Related Issue

Closes #1612

Checklist

There is no documentation on how the default MDX components work, so this doesn't need to be documented either.

  • Tests updated (or not required).
  • [ ] Documentation updated (or not required).

Copy link

netlify bot commented Nov 21, 2024

Deploy Preview for aquamarine-blini-95325f ready!

Name Link
🔨 Latest commit 6c6493d
🔍 Latest deploy log https://app.netlify.com/sites/aquamarine-blini-95325f/deploys/673f4b14c58a710008674da8
😎 Deploy Preview https://deploy-preview-1618--aquamarine-blini-95325f.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 95 (🟢 up 1 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@ap0nia ap0nia marked this pull request as draft November 21, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: doc layout components should merge className
1 participant