Skip to content

Docs: display examples based on the docs current color mode#37562

Merged
mdo merged 2 commits intomainfrom
main-jd-display-examples-in-dark-mode
Dec 29, 2022
Merged

Docs: display examples based on the docs current color mode#37562
mdo merged 2 commits intomainfrom
main-jd-display-examples-in-dark-mode

Conversation

@julien-deramond
Copy link
Copy Markdown
Member

@julien-deramond julien-deramond commented Nov 29, 2022

Description

This PR adds the color mode JS in the example layout. It also replaces .bg-light by .bg-body-tertiary to fix some color issues; but more tweaks should be added to really fix the other issues.

Motivation & Context

Users should be able to access the examples in dark mode as well.
This is a prototype to see how it would be if we just take into account the current color mode of the docs to display our examples. Another option would be to change it on the fly within the example OR to provide a light/dark button in the list of examples to display specifically one of them.

@mdo I'm not sure in which direction to go yet so your thoughts will be very important here :) IMHO it could be a first version before having something more complicated, but it'll "force us" to fix all the tiny issues in the examples in dark mode.

Another question here, do we need to mention in the migration guide that the markups (at least) have changed. Could be useful for people using the previous one as is and deciding to use the new dark mode.

Type of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • All new and existing tests passed

Live previews

Related issues

Related to #37549

@mdo mdo force-pushed the main-jd-display-examples-in-dark-mode branch from b5aa7b3 to 12086bd Compare December 29, 2022 06:52
@mdo
Copy link
Copy Markdown
Member

mdo commented Dec 29, 2022

Yes, let’s add a toggle later. And let’s also add a migration guide note, yes. I have a running list of things to update there. Will open a PR soon.

@mdo mdo merged commit 8befabb into main Dec 29, 2022
@mdo mdo deleted the main-jd-display-examples-in-dark-mode branch December 29, 2022 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants