Skip to content

Add dark mode theme to the UI #3677

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

Merged
merged 20 commits into from
May 15, 2023
Merged

Add dark mode theme to the UI #3677

merged 20 commits into from
May 15, 2023

Conversation

joshri
Copy link
Contributor

@joshri joshri commented May 9, 2023

Closes #3670

  • Adds dark mode switch that remembers your selection plus dark mode design.
  • Footer JSX and styling changed to have background inside content.
  • Sign in background changed and animation removed.
  • A ton of small changes to accommodate dark mode where we weren't prepared
Screen.Recording.2023-05-10.at.3.51.16.PM.mov

Toastify update:
image
image

Colors guide:

  • black and white switch as you'd expect.
  • neutral00 - neutral40 reverse order, which means neutral20 stays the same.
  • primary switches with primary10 NOT primary20. Primary20 was not being used, but I used it for an override on dark mode disabled buttons. It's used in one tiny lil thing in Enterprise which I'll address if I need to.
  • primaryLight05 was only being used to hide text in the Nav when collapsed - in dark mode it switches to a color that does the same. I believe it's being used for something in Enterprise and needs to be addressed. primaryLight10 was not being used in OSS so I've left it as is for now.
  • alertLight is what was being used in OSS for all error stuff, it switches to alertDark for dark mode.
  • backGray, which was being used for the top bar, now switches to the CorporateCharcoal purple-ish color used all over dark mode. (#32324B)
  • whiteToPrimary is for when you need white to switch to the CorporateCharcoal
  • grayToPrimary changes neutral30 to primary10
  • blueWithOpacity is a special override to emulate the hover effect on Nav items in the dark mode DataTable
  • Every other color is not used and so they're not changed here. When/if they come up in Enterprise, they'll be adjusted or removed accordingly.

@joshri joshri added the area/ui Issues that require front-end work label May 9, 2023
@joshri joshri requested a review from opudrovs May 9, 2023 03:12
@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

I know it's a draft but the tests are failing with message:

 error  AlertProps not found in '@material-ui/lab'  import/named

You might want to look into it earlier.

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

  • toastify notifications are not taking on my :root variable overrides

Does it mean they are positioned incorrectly?

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

  • filter icon bg is too light in dark mode

The icon's BG is not transparent? Wow.

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

Ah, maybe this AlertProps error is related to the following message you removed:

// eslint-disable-next-line

I wonder why it was added before.

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

Haha, I like the light/dark mode switch! ✨

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

Tested it locally, the dark mode looks very cool in general! 🎉 Great job!

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

Unrelated: I understood (again) that I hate horizontal scrolling in the dark mode too, but there is nothing we can do about it. 😅

Screenshot 2023-05-09 at 12 10 12

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

As for me, the command text and icon are not very readable on the dark grey background. Not sure what color would work for the command? White? Lighter blue?

Screenshot 2023-05-09 at 12 10 26

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

underline on inputs in dark mode is black. The override is located on a :before pseudo class and is giving me trouble

Screenshot 2023-05-09 at 12 36 18

Just FYI, underline on login inputs are black for me only if not hovered or focused, otherwise they are white on hover and blue on focus. And when autofilled they acquire light background.

Screenshot 2023-05-09 at 12 36 28 Screenshot 2023-05-09 at 12 36 32 Screenshot 2023-05-09 at 12 36 38

@opudrovs
Copy link
Contributor

opudrovs commented May 9, 2023

A minor issue related to underlined inputs, probably: inactive checkboxes are not visible:

Screenshot 2023-05-09 at 12 40 47

@joshri
Copy link
Contributor Author

joshri commented May 9, 2023

From design feedback:

  • I will be attempting to change the table row highlight color to the slightly transparent blue used in the nav
image
  • Yaml view header will be changed to a more consistent purple-ish
image

@JamWils
Copy link
Contributor

JamWils commented May 10, 2023

Important notes written up by @LappleApple: #2948 (comment)

@joshri
Copy link
Contributor Author

joshri commented May 10, 2023

Updated toastify to get access to their theme prop:

Screen.Recording.2023-05-10.at.10.52.12.AM.mov

@joshri joshri marked this pull request as ready for review May 10, 2023 20:02
@joshri joshri changed the title Dark mode draft Dark mode OSS May 11, 2023
Copy link
Contributor

@jpellizzari jpellizzari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI Looks fantastic 👍 .

I saw some repeated logic and I have a couple questions.

@@ -374,7 +374,10 @@ export const DataTable = styled(UnstyledDataTable)`
transition: background 0.5s ease-in-out;
}
.MuiTableRow-root:not(.MuiTableRow-head):hover {
background: ${(props) => props.theme.colors.neutral10};
background: ${(props) =>
props.theme.colors.black === "#fff"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is checking to see if we are in dark mode. Can we instead do props.theme.name === 'dark' or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new field to the DefaultTheme type called mode that uses the ThemeTypes enum

@@ -13,14 +14,16 @@ type Props = {
};

function Logo({ className, link, collapsed }: Props) {
const { settings } = React.useContext(AppContext);
const dark = settings.theme === ThemeTypes.Dark;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are repeating this in multiple places. Can we put this in a reusable hook?:

Suggested change
const dark = settings.theme === ThemeTypes.Dark;
const theme = useGetThemeSetting()
if (theme === ThemeTypes.Dark) {
...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added useInDarkMode hook which returns a boolean

@@ -10,15 +10,22 @@ type AppState = {
detailModal: DetailViewProps;
};

export enum ThemeTypes {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 🔥 🔥

jpellizzari

This comment was marked as duplicate.

{chips.length > 0 && (
<Chip
label="Clear All"
className="filter-options-chip"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 It would be cleaner to have filter-options-chip class in ChipGroup too if possible. It is not supposed to know about a class name in DataTable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed class and just moved the bg color into the component itself...not sure why it was added originally. Looked in enterprise too for a reason and I don't see one. Should be okay.

Copy link
Contributor

@opudrovs opudrovs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it locally, works and looks great! 🎉

@joshri joshri changed the title Dark mode OSS Add dark mode theme to the UI May 15, 2023
Copy link
Contributor

@jpellizzari jpellizzari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

<Link to={link || V2Routes.Automations}>
<img src={images.logotype} />
<Link to={link}>
<img src={dark ? images.logotypeLight : images.logotype} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@joshri joshri merged commit f69ed59 into main May 15, 2023
@joshri joshri deleted the dark-mode branch May 15, 2023 15:46
This was referenced May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui Issues that require front-end work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discovery and design review
4 participants