Skip to content

Commit

Permalink
Add dark mode UI to Topbar component
Browse files Browse the repository at this point in the history
  • Loading branch information
GottaGetPaid committed Feb 8, 2025
1 parent 916c5b9 commit 68a2353
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
22 changes: 20 additions & 2 deletions src/renderer/Topbar.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
.Topbar {

/* light mode */
/* unoptimized code... o-o */
.Topbar-light {
width: calc(100% - 20px);
padding: 10px;
font-family: Arial, sans-serif;
border-bottom: 1px solid var(--body-accent-color);
}
.Topbar-light > * {
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
}
/* dark mode */
.Topbar-dark {
width: calc(100% - 20px);
padding: 10px;
font-family: Arial, sans-serif;
border-bottom: 1px solid var(--body-accent-color);
color: white;
background-color: #121212;
}
.Topbar > * {
.Topbar-dark > * {
height: 100%;
display: flex;
flex-direction: row;
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/Topbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@ const FAIR_LATENCY_MS = 200;
* @param props.robotBatteryVoltage - battery voltage in volts of the currently connected robot. The
* value is not displayed to the user if robotLatencyMs is -1
* @param props.dawnVersion - version string of Dawn
* @param props.isDarkMode - whether UI is in dark mode
*/
export default function Topbar({
onConnectionConfigModalOpen,
onHelpModalOpen,
robotBatteryVoltage,
robotLatencyMs,
dawnVersion,
isDarkMode,
}: {
onConnectionConfigModalOpen: () => void;
onHelpModalOpen: () => void;
robotBatteryVoltage: number;
robotLatencyMs: number;
dawnVersion: string;
isDarkMode: boolean;
}) {
let batteryColor;
if (robotBatteryVoltage > GOOD_BATTERY_VOLTAGE) {
Expand Down Expand Up @@ -66,7 +69,7 @@ export default function Topbar({
</>
);
return (
<div className="Topbar">
<div className={`Topbar-${isDarkMode ? 'dark' : 'light'}`}>
<div className="Topbar-left-group">
<div className="Topbar-dawn-version">Dawn v{dawnVersion}</div>
{robotInfo}
Expand Down

0 comments on commit 68a2353

Please sign in to comment.