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 18 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) Nov 1, 2024 9:26pm
next-themes-tailwind ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 1, 2024 9:26pm
next-themes-with-app-dir ❌ Failed (Inspect) Nov 1, 2024 9:26pm

@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.

trm217 and others added 3 commits November 1, 2024 21:49
….4-and-up

docs: update docs on how to use with tailwindcss >3.4.1
chore: use corepack instead of pnpm setup action in ci
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