Having light/dark pages but not using theming #72824
Unanswered
AnzeKop
asked this question in
App Router
Replies: 1 comment 1 reply
-
Why weird? The layout file can be different, but make use of the same component, with a different prop, as you do in getStaticProps... Anyway, how is it decided which one should be dark or light mode? Is it driven by the CMS? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This sounds like a very wierd title but we have a website where half of our pages are light theme and half are dark and we don't let the user swap between them.
In the pages router we were able to call getStaticProps and return a theme prop: 'light' or 'dark' which could be picked up by the root _app.tsx layout to add the 'dark' class to the wrapping dive all while staying on the server and avoiding any on screen flash.
we're moving to the app router and I'm starting to realise this isn't possible anymore. The only idea I've had so far is seperating it two folders (light), (dark) and then having seperate layout.tsx files but this seems like a wierd approach.
Does anyone have any recommendations here?
As context, we are using Payload CMS, Tailwind, ShadCn
Beta Was this translation helpful? Give feedback.
All reactions