Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

[Feature] Possibility to define where the theme change button appears: (docs, canvas or both) #85

Open
dgateles opened this issue Aug 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@dgateles
Copy link

Describe the feature

When using withThemeByDataAttribute, it happens to apply the theme also to the Docs (mdx), causing in some circumstances the examples to break (apply dark theme and the background remains light). Thinking about it, it would be interesting to be able to define where this theme will be applied and also the possibility of saying where the theme exchange button should appear.

@dgateles dgateles added the bug Something isn't working label Aug 11, 2023
@ShaunEvening
Copy link
Contributor

Hey @dgateles 👋

This is more a bug with how specific the styling for the docs are, unfortunately. Docs are set up this way to maintain a fairly consistent markdown look and feel.

My concern with tying your component themes and documentation themes is that it puts the responsibility to provide all the styles for your docs too. This is why we render components in the preview iframe.

This is something that we need to figure out how to address at a higher level than this addon. However, you're certainly right that it's not a great experience!

As a workaround, i'd suggest adding a rule that targets the story container in the docs specifically like so:

/* When html has dark theme toggled, apply background color to .docs-story */
html[data-theme="dark"] .docs-story {
   background-color: #222222
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants