-
Notifications
You must be signed in to change notification settings - Fork 500
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 dark mode #2322
base: main
Are you sure you want to change the base?
feat: add dark mode #2322
Conversation
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
Hi @lidel, kindly take a look at this when you get the chance. Thanks. |
@kaf-lamed-beyt I would love for all components in ipfs-webui to be functional components. That is the direction we're moving. However, since that will likely be a significant change, we should probably do that as a separate PR. You can see an example of a simple function component that is also using redux-bundler-react at
|
Oh! Thanks for the feedback, @SgtPooki! I'll take a look at the file you pointed me to now. So, from the looks of things now, are you suggesting that i use the manual approach of targeting each element based on the styles in We can always keep the hook. |
<div className='mb4'> | ||
<ThemeToggle /> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 the space in the left NavBar is limited especially in ipfs-desktop where UI acts as native app. and window height is limited by default.
we want to add diagnostics screen at some point
perhaps it is better to move this toggle to top right corner where we already have two items:
thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, yeah! that sounds goood, @lidel!
i originally thought of placing it there, but couldn't locate the icons in the code. I'll try looking for them and update the theme toggle's position
fixes #1702
Hi @lidel, This is what I have so far. I'm currently using an approach involving a Context Provider to access the theme value across the entire application.
I'm also adding the styles individually in index.css by targeting the
data-theme
attribute. This is nice, but it can be quite tasking, hence my move towards a custom context hook. This would allow us to dynamically change colors across components in the application.I ran into a slight blocker though.
App.js
uses a legacy React pattern — a class-based component which makes it a bit difficult to use the hook in this component, so I resorted to using the value fromlocalStorage
which is outside of the component/app life-cycle. So even if the value oftheme
inlocalStorage
changes, the color — based on the ternary operation below — of the header won't change, because we do not trigger a re-render. Which is what the hook helps us achieve.So, my question now is if it is possible to refactor
App.js
into a function-based component