Git Product home page Git Product logo

Comments (3)

mrjackyliang avatar mrjackyliang commented on June 1, 2024 2

I don't want to be picky, it is a very nice integration.

But...

I am looking to store the theme info in Redux and have the provider read directly from Redux store instead.

from next-themes.

trm217 avatar trm217 commented on June 1, 2024

My thoughts on: #71 (comment)

Don't you think having a generic option might be a bit over engineered for the common use cases?

I thought of the following implementation would solve #72 quiet nicely.

  • Add a storage property: the accepted values are : none, sessionStorage, localStorage.

In regards to a 'generic' custom solution :
I think it would be cool if it was possible to hook into the theme changes, to for example allow
the syncing of a users theme-preferences with a data-storage.

  • For custom storage options we could define a simple interface. I believe something like this might make sense:
   interface ExternalThemeStorage extends EventTarget { // EventTarget could be an overkill tbh
      get: () => Promise<string | null>
      set: (value: string) =>  Promise<void>
      delete: () => Promise<void>
   }

An object implementing this interface could then be passed to the customStorage property to be used inside the ThemeProvider.

I think allowing the user to combine both the storage property and customStorage property could be very useful,
since saving a users preferences over multiple devices is fairly common.

from next-themes.

omarabid avatar omarabid commented on June 1, 2024

I don't want to be picky, it is a very nice integration.

But...

I am looking to store the theme info in Redux and have the provider read directly from Redux store instead.

Have you made any progress on that?

from next-themes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.