Skip to content

Commit

Permalink
demo: Dark mode improvements (#94)
Browse files Browse the repository at this point in the history
Also add new logos for dark mode.
  • Loading branch information
yoonieaj authored Oct 15, 2024
1 parent 8bea202 commit 917f661
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### ✨ Enhancements

- Added transparent and dark mode versions of the logos!

### 🐛 Bug fixes

- Fixed a bug where the `Download JSON` button would not download the JSON currently inside the input box.
Expand All @@ -21,6 +23,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Made text input box use a monospace font
- Disabled download buttons when there is no input/output.
- Added a dialog to the file input section.
- Made improvements to the dark mode version of the website.

### 🔧 Internal changes

Expand Down
Binary file added assets/logo_dark_full_trans.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo_full_dark_transparent.psd
Binary file not shown.
Binary file added assets/logo_full_trans.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo_full_transparent.psd
Binary file not shown.
Binary file added assets/logo_square_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo_square_dark.psd
Binary file not shown.
12 changes: 9 additions & 3 deletions demo/src/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import React from "react";
import { Box, Link, Stack, Typography } from "@mui/material";
import image from "../../assets/logo_square.png";
import { Box, Link, Stack, Typography, useMediaQuery } from "@mui/material";
import lightLogo from "../../assets/logo_square.png";
import darkLogo from "../../assets/logo_square_dark.png";
import { dark } from "@mui/material/styles/createPalette";

export default function Header() {
const logo = useMediaQuery("(prefers-color-scheme: dark)")
? darkLogo
: lightLogo;

return (
<header className="container">
<Stack direction={"row"} justifyContent={"space-between"}>
Expand All @@ -29,7 +35,7 @@ export default function Header() {
</Typography>
</Box>
<img
src={image}
src={logo}
alt="MemoryViz Logo"
style={{
width: "100px",
Expand Down
1 change: 1 addition & 0 deletions demo/src/SvgDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default function SvgDisplay(props: SvgDisplayPropTypes) {
return (
<Paper
sx={{
bgcolor: `primary.paper`,
height: 500,
overflow: "hidden",
display: "flex",
Expand Down
41 changes: 36 additions & 5 deletions demo/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,53 @@ import App from "./App";
import "@picocss/pico";
import "./css/styles";

import { ThemeProvider, createTheme } from "@mui/material/styles";
const theme = createTheme({
import { createTheme, ThemeProvider } from "@mui/material/styles";
import { useMediaQuery } from "@mui/material";

declare module "@mui/material/styles" {
interface PaletteColor {
paper?: String;
}

interface SimplePaletteColorOptions {
paper?: string;
}
}

const lightTheme = createTheme({
palette: {
primary: {
main: "#2a6b2c",
dark: "#005ea5",
light: "#72ac56",
paper: "#ffffff",
},
},
});

const darkTheme = createTheme({
palette: {
mode: "dark",
primary: {
main: "#89c48c",
paper: "#cacaca",
},
},
});

function Root() {
const usingDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
return (
<ThemeProvider theme={usingDarkMode ? darkTheme : lightTheme}>
<App />
</ThemeProvider>
);
}

const root = createRoot(document.getElementById("root"));

root.render(
<StrictMode>
<ThemeProvider theme={theme}>
<App />
</ThemeProvider>
<Root />
</StrictMode>
);

0 comments on commit 917f661

Please sign in to comment.