Skip to content

Commit

Permalink
Switch to new CSS variables (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep authored Sep 3, 2024
1 parent f512d72 commit f68f42c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/Plotly.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const defaultOverride = (theme: Theme): Partial<PlotParams> => ({
layout: {
paper_bgcolor: 'transparent',
plot_bgcolor: 'transparent',
font: { color: theme.palette.text.primary },
font: { color: theme.vars.palette.text.primary },
xaxis: { automargin: true },
yaxis: { automargin: true },
margin: {
Expand Down
10 changes: 6 additions & 4 deletions src/components/routes/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
createTheme,
responsiveFontSizes,
} from '@mui/material/styles'
import useMediaQuery from '@mui/material/useMediaQuery'

import Blog from '../Blog'
import Code from '../Code'
Expand Down Expand Up @@ -56,20 +55,23 @@ const hSizes = Object.fromEntries(
)

const App = () => {
const dark = useMediaQuery('(prefers-color-scheme: dark)')
const theme = useMemo(() => {
const baseTheme = createTheme({
cssVariables: true,
typography: {
fontFamily: '"Iosevka Aile", sans-serif',
...hSizes,
},
colorSchemes: {
light: true,
dark: true,
},
palette: {
mode: dark ? 'dark' : 'light',
primary: deepPurple,
},
})
return responsiveFontSizes(baseTheme)
}, [dark])
}, [])
const currentTab = useRouteMatch(ROUTE_LINKS.map(({ pattern }) => pattern))
?.pattern.path

Expand Down
1 change: 1 addition & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="vite/client" />
/// <reference types="@total-typescript/ts-reset" />
/// <reference types="unplugin-fonts/client" />
/// <reference types="@mui/material/themeCssVarsAugmentation" />

import 'unfonts.css'
import './main.css'
Expand Down

0 comments on commit f68f42c

Please sign in to comment.