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

Refactor ModalProvider to remove wrapper div and apply theme props directly #2176

Closed

Conversation

Adebesin-Cell
Copy link

Refactor ModalProvider to remove wrapper div and apply theme props directly

This PR refactors the ModalProvider component to remove the unnecessary wrapper div and apply theme properties directly to its children. This change allows for more flexible use of the ModalProvider throughout the component tree.

Key changes:

  • Removed the wrapper div from ModalProvider
  • Used React.Fragment to avoid adding extra DOM elements
  • Applied theme properties directly to child elements using React.Children.map
  • Conditionally rendered the style element only when a theme is provided

This refactor improves the flexibility of the ModalProvider, allowing it to be used at any point in the component tree without introducing additional DOM nesting. It maintains all existing theming functionality while providing a cleaner, more efficient implementation.

Testing:

  • Verified that the ModalProvider works correctly with and without a theme
  • Ensured that theme properties are correctly applied to child components
  • Checked that the component renders correctly in different contexts without introducing unexpected DOM elements

Please review and test thoroughly to ensure this change doesn't introduce any unintended side effects in existing implementations.

Fixes #2164

@Adebesin-Cell Adebesin-Cell requested a review from a team as a code owner September 11, 2024 06:12
Copy link

vercel bot commented Sep 11, 2024

@Adebesin-Cell is attempting to deploy a commit to the rainbowdotme Team on Vercel.

A member of the Team first needs to authorize it.

@DanielSinclair
Copy link
Collaborator

At this time, we don't need any refactors. If you're interested in contributing, feel free to investigate our open Issues and submit fixes, if necessary.

@Adebesin-Cell
Copy link
Author

At this time, we don't need any refactors. If you're interested in contributing, feel free to investigate our open Issues and submit fixes, if necessary.

I think it was part of opened issues about DOM injection.

cc: #2164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Provider affects the DOM
2 participants