Implement dark theme (Closes #287) #407
Merged
e26chiu
merged 13 commits from dark-theme
into main
10 months ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'dark-theme'
Deleting a branch is permanent. It CANNOT be undone. Continue?
themer
page to override some properties.themer
page.Staging link: https://csclub.uwaterloo.ca/~a3thakra/csc/dark-theme/
<Button
size="small"
onClick={() =>
themeContext?.theme.name == "dark"
use ===
.card:nth-child(odd) h2,
.card:nth-child(odd) h3,
.card:nth-child(odd) h4 {
color: var(--primary-subtitle);
two things:
What do you mean by doing this in react explicitely? Also, I tried to put this part in the parent's stylesheet but this seems not to affect the styling of the header (since
.card
is out of scope). The other solution I could think of is to pass the styling to the component from the page. Then again, I think it would be simpler to have the styling inside of the component instead.Also, does that mean that the code with
will also need to be put outside of the component since it cares about its neighbors?
Yes
Yes, passing the prop is the way to go here. It is a little more work, but it makes a lot more sense in terms of maintainability. Something like this in the page component.
and then you can apply a class on it based on whatever prop is passed in. That way your styles are still contained in the same css file, but the logic that dictates what an adjacent MiniEventCard looks like is not being leaked into the component styles.
Note that this is not as important as the other issues that I have mentioned.
}
.card:nth-child(odd) .details {
color: var(--primary-subtitle);
view details is a link, and it should be visible as a link. we shouldn't change this color
This colour is in the Figma design: https://www.figma.com/file/vu3AIDmN8vLALfwPbtPhO4/CS-Club-Official-Figma?node-id=639%3A484 Should we change it just for the sake of keeping it as a link?
Although figma is our source of truth and we should stick to it as much as possible, bit it is not set in stone. We can give this feedback to the design team and raise the issue with them.
IMO if we don't make it look like something will happen if we click on it - then it is not drawing the user's attention to click on it - and they probably wont - which is not good.
mobile navbar in dark mode has some problems
table rows look a little intense compared to light theme
mobile organized content is unthemed
good job overall! 🎉
i think more people should take passes on this. perhaps you should share the staging link with the design team and ask them to take a look.
other internal members could also help with reviewing once you announce this at all hands. make sure to share a link to the staging website.
let everyone know that they can easily toggle between light and dark using the button in the footer.
.bubble {
--border-radius: calc(5000rem / 16);
border-radius: calc(5000rem / 16);
@e26chiu the bubbles are still broken :'(
Go to the about us page to see the difference: https://csclub.uwaterloo.ca/~a3thakra/csc/dark-theme/about/
Once you change this back to a variable as I suggested above, the bubbles should be fixed.
online: boolean;
location: string;
date: Date;
background: string;
background: "light" | "dark"
Non blocker for PR: Create another issue for bad scrollbar color
Chat with the design team to figure out a better color for this because this stands out too much
/* Default is light theme */
--primary-background: #ffffff;
--secondary-background: #fdf8f5;
--light-primary-background: #ffffff;
--light--primary-background
and--dark--primary-background
if (customPalette == null) {
setThemeName("light");
const prefersDark = window.matchMedia(
I don't think we need this, we already have this in css.
document.body.classList.add("light");
} else if (input === "dark") {
document.body.classList.add("dark");
document.body.classList.remove("light");
We don't need
light
anddark
classes anymore (not in css either). We can usePALETTE_NAMES.forEach(...)
to programatically set the prefix on the theme.Wow! This is big, great work Emily! There just a few things I noticed while going through the staging site that we should address before shipping this:
I also left some nitpicky comments about code style, those are less important than these user-facing visual bugs though. 🙂
box-sizing: border-box;
position: relative;
padding: calc(20rem / 16);
background-color: var(--card-background);
Idea: since there are some repeated styles between
.card
and.darkBg
, what if we "had all the default style" apply to.card
, and then use a selector like.card.darkBg
as an "override" for the background colour? (or even just.darkBg
should work, as long as it comes after the other selector)eg.
In order for this to work though, we would have to slightly change how the classNames are applied.
.name {
display: flex;
font-size: calc(18rem / 16);
font-size: 18px;
Why are we using
px
instead ofrem
here?list-style: none;
}
.darkBg > summary {
NIT: For this and the other styles below, it would be shorter to write
onClick={() => dispatch({ type: "open", route: router.pathname })}
>
<Image src="/images/hamburger.svg" alt="Menu" />
<svg
NIT: Instead of writing out these SVGs inline, it might be more readable to extract them into components (functions) like
HamburgerSvg
andDropdownSVG
? (but keeping them in the same file, just at the bottom)See the SocialLinks component for an illustrative example.
)}
<div className={styles.miniEventCards}>
{props.pastEvents.map(({ content, metadata }) => (
{props.pastEvents.map((event, key) => (
Super NIT: rename
key
toidx
😛}
.adviceBarContainer a:hover {
color: var(--link-hover);
EDIT: This relates to #426, but I think the actual fix is slightly different/beyond the scope of the dark theme
The most recent push should fix all of @a258wang 's comments and suggestions! Note: I believe point #1 (border-radius) was already resolved.
News archive just looks like a wall of text compared to the light theme.
It might need brighter headlines.
https://csclub.uwaterloo.ca/~a3thakra/csc/dark-theme/news/2022/spring/
.table tbody tr:nth-child(odd) {
background: var(--primary-accent-lightest);
.table tbody tr:nth-child(even) {
Just curious, why was this changed from
odd
toeven
?I think I misread what you wrote:
I thought the background of the first row needed to be changed because in dark mode, it's very similar to the header (might not contrast well enough). However, you were talking about the colours of the vertical lines. 😅
For the vertical lines in the table, do you think this would be better?

I don't think there is an issue with having a similar colour for the vertical lines and the header as long as there is enough spacing between each header headings and column text. However, it would make sense to change the colour of the vertical lines if we want to keep the same design for the light theme and the dark theme (the light theme has a vertical line colour different than the header's colour).
I think what you have in this screenshot looks fine! It would be nice to have a similar design for both light + dark themes, but I agree that it's not a big deal in this particular case - let's not block this PR over it, and we can always make a ticket to revisit it later. 🙂
--light--button-background: #1482e3;
--light--footer-background: #2a2a62;
--light--card-background: #DCF6F0;
Careful here, now the news cards on the home page are green 😂 https://csclub.uwaterloo.ca/~a3thakra/csc/dark-theme/
We can either change around the usage of the existing variables, or create a new variable if necessary.
@a3thakra Do you think adding space between each news item would make the page look less like a wall of text? I think it would make each news item more distinguishable since currently, the spacing is not very consistent: there is more spacing between the paragraphs of the news item than the one between the news items themselves.
It would also follow the Gestalt proximity principle of linking items together when they are closer to each other.
+1, I think the news items on the news archive page need more space between each other (regardless of light vs. dark mode). We can make a ticket to take a closer look at this later.
Thanks for working on this @e26chiu! I'd say let's get this PR merged sooner rather than later, then we can address the remaining details and any small bugs that arise in follow-up tickets. 🚢
f631f4013f
into main 10 months agoYes I think that should do it! :)
Sorry for the late response, I haven't been checking mattermost or my csc emails too often in the past couple weeks :'(
Reviewers
f631f4013f
.