Skip to content

Dark mode UI Update #323

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 4 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/components/Acknowledgements/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@
padding: 0;
}
}

body.dark-mode .acknowledgements {
background-color: #161a1d;
color: #ffffff;

.card {
background-color: #1d2125;
color: #ffffff;
}
}
31 changes: 31 additions & 0 deletions src/components/Dark-Mode/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { useState, useEffect } from 'react';
import Toggle from 'react-toggle';

const DarkMode = () => {
const [darkMode, setDarkMode] = useState(() => {
const savedMode = localStorage.getItem('darkMode');
return savedMode ? JSON.parse(savedMode) : false;
});

const toggleDarkMode = () => {
setDarkMode(prevMode => {
const newMode = !prevMode;
localStorage.setItem('darkMode', newMode);
return newMode;
});
};
useEffect(() => {
document.body.className = darkMode ? 'dark-mode' : 'light-mode';
}, [darkMode]);

return (
<Toggle
id="darkMode-toggle"
checked={darkMode}
onChange={toggleDarkMode}
icons={{ checked: '🌙', unchecked: '☀️' }}
/>
);
};

export default DarkMode;
4 changes: 3 additions & 1 deletion src/components/Navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import { FaGithub } from 'react-icons/fa';
import { Event } from '../Shared/Tracking';

import './styles.scss';
import DarkMode from '../Dark-Mode';

const Navigation = () => {
return (
<Navbar color="light" light>
<Navbar className="navbar">
<Container>
<NavbarBrand
onClick={() =>
Expand All @@ -34,6 +35,7 @@ const Navigation = () => {
</NavLink>
</NavItem>
</Nav>
<DarkMode />
</Container>
</Navbar>
);
Expand Down
23 changes: 23 additions & 0 deletions src/components/Navigation/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
body.light-mode .navbar {
background-color: #f7f8f9;
color: #000000;
}
body.light-mode .navbar a {
color: #212529;
}

body.dark-mode .navbar {
background-color: #1d2125;
color: #ffffff;
}
body.dark-mode .navbar a {
color: #ffffff;
}
body.dark-mode .navbar-nav svg {
color: #ffffff;
}
body.dark-mode .navbar-nav svg:hover {
color: #ffc952;
}

.navbar-brand {
font-weight: 600;
letter-spacing: 1px;
Expand Down Expand Up @@ -29,5 +51,6 @@

svg {
font-size: 2em;
margin: 0px 10px;
}
}
2 changes: 1 addition & 1 deletion src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const Table = () => {
labelPosition={0}
labelStyle={{
// Needed for Dark Reader to work
fill: 'black',
fill: '#A54800',
}}
startAngle={-90}
lineWidth={12}
Expand Down
51 changes: 51 additions & 0 deletions src/components/Table/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
body.light-mode .table {
background-color: #ffffff;
color: #000000;
}
body.light-mode .table thead > tr th {
background-color: #ffffff;
}
body.light-mode .pattern-count {
background-color: #ffffff;
color: #000000;
}
body.light-mode .table tr:nth-child(odd) {
background-color: #f1f2f4;
}
body.light-mode .table tr:nth-child(even) {
background-color: #ffffff;
}
body.light-mode .table tbody tr:hover {
background-color: #dcdfe4;
color: #000000;
}

body.dark-mode .table {
background-color: #161a1d;
color: #ffffff;
}
body.dark-mode .table thead > tr th {
background-color: #161a1d;
}
body.dark-mode .pattern-count {
background-color: #161a1d;
color: #ffffff;
}
body.dark-mode .table tr:nth-child(odd) {
background-color: #22272b;
}
body.dark-mode .table tr:nth-child(even) {
background-color: #161a1d;
}
body.dark-mode .table tbody tr:hover {
background-color: #101214;
color: #ffffff;
}
body.dark-mode .modal-content {
background-color: #1d2125;
color: #ffffff;
.close {
color: #ffffff;
}
}

.table {
.row {
justify-content: center;
Expand Down
14 changes: 14 additions & 0 deletions src/components/Tips/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,17 @@
color: #333;
background: #f8f8f8;
}
body.light-mode .tips {
background-color: #f7f8f9;
color: #333;
}

body.dark-mode .tips {
background-color: #1d2125;
color: #ffffff;
}
body.dark-mode .tips pre,
body.dark-mode .tips code {
background-color: #1d2125;
color: #ffffff;
}
18 changes: 16 additions & 2 deletions src/components/styles.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,700');

.App {
margin-left: calc(100vw - 100%);
margin-right: 0;

font-family: 'Open Sans', sans-serif;
font-size: 14px;
-webkit-font-smoothing: antialiased !important;
}

body.light-mode {
background-color: #ffffff;
color: #000000;
}
body.light-mode a {
color: #0c66e4;
}

body.dark-mode {
background-color: #161a1d;
color: #ffffff;
}
body.dark-mode a {
color: #579dff;
}
Loading