-
-
Notifications
You must be signed in to change notification settings - Fork 61
Added toggle button #96
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,22 +1,40 @@ | ||||||||||||||||||||||||||||||||
| // App.js | ||||||||||||||||||||||||||||||||
| import { useState } from "react"; | ||||||||||||||||||||||||||||||||
| import { BrowserRouter, Routes, Route } from "react-router-dom"; | ||||||||||||||||||||||||||||||||
| import { ThemeProvider } from "@mui/material"; | ||||||||||||||||||||||||||||||||
| import EditorComponent from "./pages/EditorComponent"; | ||||||||||||||||||||||||||||||||
| import theme from "./theme"; | ||||||||||||||||||||||||||||||||
| import { lightTheme, darkTheme } from "./theme"; | ||||||||||||||||||||||||||||||||
| import SnackbarProvider from "./components/js/SnackbarProvider"; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| function App() { | ||||||||||||||||||||||||||||||||
| const [darkMode, setDarkMode] = useState(false); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| const toggleTheme = () => { | ||||||||||||||||||||||||||||||||
| setDarkMode((prevMode) => !prevMode); | ||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+13
|
||||||||||||||||||||||||||||||||
| const [darkMode, setDarkMode] = useState(false); | |
| const toggleTheme = () => { | |
| setDarkMode((prevMode) => !prevMode); | |
| const [darkMode, setDarkMode] = useState(() => { | |
| const savedTheme = localStorage.getItem("darkMode"); | |
| return savedTheme === "true" ? true : false; | |
| }); | |
| const toggleTheme = () => { | |
| setDarkMode((prevMode) => { | |
| const newMode = !prevMode; | |
| localStorage.setItem("darkMode", newMode); | |
| return newMode; | |
| }); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,8 +14,8 @@ | |||||
| margin-left: 0.5rem; | ||||||
| margin-right: 0.5rem; | ||||||
| padding: 0.5rem; | ||||||
| border: 3px solid rgba(0, 0, 0, 0.096); | ||||||
| border-radius: 1rem; | ||||||
| transition: background-color 0.3s ease; | ||||||
| } | ||||||
|
|
||||||
| .sidebar { | ||||||
|
|
@@ -32,15 +32,15 @@ | |||||
| } | ||||||
|
|
||||||
| .output { | ||||||
| background-color: #d8dbcc; | ||||||
| height: 22.3vh; | ||||||
|
||||||
| height: 22.3vh; | |
| height: var(--output-height); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,15 @@ body { | |
| margin: 0; | ||
| font-family: 'Poppins'; | ||
| } | ||
|
|
||
| /* Light Mode */ | ||
| .light-mode { | ||
|
||
| background-color: #f9f9f9; | ||
| color: #333; | ||
| } | ||
|
|
||
| /* Dark Mode */ | ||
| .dark-mode { | ||
| background-color: #333; | ||
| color: #f9f9f9; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,54 @@ | ||
| // theme.js | ||
| import { createTheme } from "@mui/material/styles"; | ||
|
|
||
| const theme = createTheme({ | ||
| export const lightTheme = createTheme({ | ||
| palette: { | ||
| mode: "light", | ||
| primary: { | ||
| main: "#1976d2", | ||
| }, | ||
| secondary: { | ||
| main: "#dc004e", | ||
| }, | ||
| background: { | ||
| default: "#fff", | ||
| paper: "#f5f5f5", | ||
| }, | ||
| text: { | ||
| primary: "#000", | ||
| secondary: "#555", | ||
| }, | ||
| }, | ||
| typography: { | ||
| h1: { | ||
| fontSize: "2rem", | ||
| }, | ||
| fontFamily: [ | ||
| "Poppins", | ||
| ], | ||
| fontFamily: ["Poppins"], | ||
| }, | ||
| }); | ||
|
|
||
| export default theme; | ||
| export const darkTheme = createTheme({ | ||
| palette: { | ||
| mode: "dark", | ||
| primary: { | ||
| main: "#90caf9", | ||
| }, | ||
| secondary: { | ||
| main: "#f48fb1", | ||
| }, | ||
| background: { | ||
| default: "#121212", | ||
| paper: "#1e1e1e", | ||
| }, | ||
| text: { | ||
| primary: "#fff", | ||
| secondary: "#aaa", | ||
| }, | ||
| }, | ||
| typography: { | ||
| h1: { | ||
| fontSize: "2rem", | ||
| }, | ||
| fontFamily: ["Poppins"], | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the linebreak-style from 'unix' to 'windows' affects the entire team's development environment. This change should be coordinated with the team and may not be appropriate for a theme toggle feature.