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

Access dark/light state in the preview #312

Closed
eric-burel opened this issue Sep 3, 2024 · 1 comment
Closed

Access dark/light state in the preview #312

eric-burel opened this issue Sep 3, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@eric-burel
Copy link
Contributor

Is your feature request related to a problem?

The application preview stays in light mode when tutorial kit is switched to dark mode, which is not super aesthetic
image

Describe the solution you'd like.

Transfer the dark/light param to the container preview.

Describe alternatives you've considered.

I think this issue has been solved by SvelteKit team, as I see they pass a query string parameter to the webcontainer URL:
image

In the learn sveltekit tutorial codebase, they have a script tag that seem to handle this parameter and apply a class to the preview document: https://github.com/sveltejs/learn.svelte.dev/blob/main/content/tutorial/common/src/app.html

Leading to a great UX when switching from light to dark mode, as the preview theme also changes and not only the tutorial UI.

The missing piece is: how do we pass a query param with the current theme to the webcontainer?

Additional context

No response

@AriPerkkio
Copy link
Member

This is duplicate of #247, let's move discussion there.

Adding the value of theme in iframe's URL as query parameter would allow users to capture it from location.search, but we are planning to add better support for this. @Nemikolh had some good ideas regarding this.

@AriPerkkio AriPerkkio closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2024
@AriPerkkio AriPerkkio added the duplicate This issue or pull request already exists label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants