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

feat: add 'cookie' as a storage strategy for storing the theme #294

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

trm217
Copy link
Collaborator

@trm217 trm217 commented May 9, 2024

Cookies

This PR is built on top of #293 and adds a 'cookie' as the third option for the ThemeProviders 'storage' property.

#### Tasks

  • Update ThemeProvider to handle storage='cookie'
  • Update ThemeScript to handle storage='cookie'
  • Add tests for storage='cookie'
  • Update documentation
  • [-] Add a event listener to handle the cookies being changed in order to sync the selected theme across multiple browser-windows (just as we already do with localStorage)
    • I couldn't find a reliable way to do this. There seems to be an event-listener related to the cookieStore API, however this still is an experimental feature.

Copy link

vercel bot commented May 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-themes-basic ❌ Failed (Inspect) May 9, 2024 3:02pm
next-themes-tailwind ❌ Failed (Inspect) May 9, 2024 3:02pm
next-themes-with-app-dir ❌ Failed (Inspect) May 9, 2024 3:02pm

@trm217 trm217 self-assigned this May 9, 2024
@wontory
Copy link

wontory commented Jul 18, 2024

I really need this feature. While structuring my app as a monorepo, I expect it will become possible to share themes among different domains.

@trm217
Copy link
Collaborator Author

trm217 commented Jul 18, 2024

@wontory Just waiting for @pacocoursey review.
Give it some time. If it's urgent, you can easily write a wrapper that syncs to a cookie (and initialises from it).

@touka-0
Copy link

touka-0 commented Oct 28, 2024

any update? wait for long...

@trm217
Copy link
Collaborator Author

trm217 commented Oct 28, 2024

@touka-0 No update. The repository no longer appears to be maintained.

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.

3 participants