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

None yet

1 participant