-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Some clean up, added Spotify icon for offline/loading state * Minor clean up in Mobile view * Updating about text. * Fixing max width for the Tab Panel * P-18: fixed bug when type is not track * P-20: Add real time spotify streaming progress bar. (#21) * P-23: Added experience section. (#24) * P-26: Added placeholder projects section. (#27) * Wip footer. * develop: some footer updates, brb. * develop: simple footer. * P-11 (#31) * P-11: added vitest, react testing library config for unit testing. * P-11: add Projects unit test. * P-11: fix bg card color. * P-11 (#32) * P-11: added vitest, react testing library config for unit testing. * P-11: add Projects unit test. * P-11: fix bg card color. * P-11: almost done, missing Github actions and TODOS in test. * Update src/components/Navigation/Navigation.test.tsx * theme-mode: add dark/light mode. (#38)
- Loading branch information
1 parent
b58d044
commit 2d2c04a
Showing
9 changed files
with
129 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { PaletteMode, PaletteColor } from "@mui/material"; | ||
|
||
type CustomPaletteColor = Omit<PaletteColor, "light" | "dark" | "contrastText">; | ||
|
||
type CustomPalette = { | ||
mode: PaletteMode; | ||
primary: CustomPaletteColor; | ||
secondary: CustomPaletteColor; | ||
info: CustomPaletteColor; | ||
}; | ||
|
||
export const darkPalette: CustomPalette = { | ||
mode: "dark", | ||
primary: { | ||
main: "#000000", | ||
}, | ||
secondary: { | ||
main: "#FDB3FD", | ||
}, | ||
info: { | ||
main: "#ECECEC", | ||
}, | ||
}; | ||
|
||
export const lightPalette: CustomPalette = { | ||
mode: "light", | ||
primary: { | ||
main: "#FFFFFF", | ||
}, | ||
secondary: { | ||
main: "#E61680", | ||
}, | ||
info: { | ||
main: "#000000", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import * as React from "react"; | ||
import type { PaletteMode, Theme } from "@mui/material"; | ||
import { ThemeProvider, createTheme } from "@mui/material/styles"; | ||
import { baseTheme } from "./base-theme"; | ||
import { lightPalette, darkPalette } from "./palettes"; | ||
|
||
export interface ThemeContextProps { | ||
toggleTheme: () => void; | ||
theme: Theme; | ||
} | ||
|
||
export const ThemeContext = React.createContext<ThemeContextProps>({ | ||
toggleTheme: () => {}, | ||
theme: createTheme(baseTheme), | ||
}); | ||
|
||
export const ThemeProviderWrapper: React.FC<{ children: React.ReactNode }> = ({ | ||
children, | ||
}) => { | ||
const [mode, setMode] = React.useState<PaletteMode>("light"); | ||
|
||
const toggleTheme = () => { | ||
setMode((prevMode) => (prevMode === "light" ? "dark" : "light")); | ||
}; | ||
|
||
const theme = React.useMemo(() => { | ||
const palette = mode === "light" ? lightPalette : darkPalette; | ||
return createTheme({ | ||
...baseTheme, | ||
palette, | ||
components: { | ||
MuiCssBaseline: { | ||
styleOverrides: { | ||
...((baseTheme.components?.MuiCssBaseline | ||
?.styleOverrides as object) || {}), | ||
body: { | ||
backgroundColor: palette.primary.main, | ||
color: palette.info.main, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}, [mode]); | ||
|
||
return ( | ||
<ThemeContext.Provider value={{ toggleTheme, theme }}> | ||
<ThemeProvider theme={theme}>{children}</ThemeProvider> | ||
</ThemeContext.Provider> | ||
); | ||
}; |