osuresearch / ui

Ohio State Research UI
https://osuresearch.github.io/ui/main
MIT License
6 stars 3 forks source link

Conflicting CSS reset with existing products #33

Closed McManning closed 1 year ago

McManning commented 1 year ago

Trying to integrate RUI 5 components with Docusaurus results in some interesting results due to our aggressive TailwindCSS reset.

How docs originally look (out of the box classic theme):

Screen Shot 2023-02-08 at 3 29 50 PM

With the RUI styles imported:

Screen Shot 2023-02-08 at 3 28 20 PM

I'm not against making a whole Docusaurus theme with RUI - but it'd be nice if we could also embed and have things play nicely together since this will be a future problem with other products.

I know some libraries (Mantine?) have a setting of some sort that allows you to specify whether or not resets are applied. Or we apply resets specifically to the RUIProvider scope and touch nothing outside of there.

GraphiQL uses the "just apply within the container" approach as well for resets. E.g.:

.graphiql-container * {
  box-sizing: border-box
}
McManning commented 1 year ago

Here's mantine's approach: https://mantine.dev/theming/mantine-provider/#usage

Essentially, the provider can optionally apply global styles (fonts, headings, etc) and optionally provide normalization. If, say, we're integrating with something like Docusaurus that uses Infima to apply global styles, I wouldn't want RUI to override those globals. But I want RUI to specify sane defaults for nested content.

At the very least, I think having options on the provider to normalize before content within the provider makes sense.

McManning commented 1 year ago

Obsolete in beta.1