From 57cbac38c98ee54bd061ad07083aae621f64b3ea Mon Sep 17 00:00:00 2001 From: Daniel Shleifman Date: Mon, 21 Jun 2021 00:38:58 +0300 Subject: [PATCH] refactor --- web/src/components/About.jsx | 4 ++-- .../TorrentCache/snakeSettings.js | 4 ++-- web/src/components/TorrentList/AddFirstTorrent.jsx | 4 ++-- web/src/components/TorrentList/NoServerConnection.jsx | 4 ++-- web/src/style/materialUISetup.js | 11 +++++++++-- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/web/src/components/About.jsx b/web/src/components/About.jsx index ed1b4b1..d4bc273 100644 --- a/web/src/components/About.jsx +++ b/web/src/components/About.jsx @@ -12,11 +12,11 @@ import ListItemText from '@material-ui/core/ListItemText' import { useTranslation } from 'react-i18next' import { echoHost } from 'utils/Hosts' import { ThemeProvider } from '@material-ui/core/styles' -import { themeColors } from 'style/colors' +import { mainColors } from 'style/colors' import { lightTheme } from '../style/materialUISetup' -const { primary } = themeColors +const { primary } = mainColors export default function AboutDialog() { const { t } = useTranslation() diff --git a/web/src/components/DialogTorrentDetailsContent/TorrentCache/snakeSettings.js b/web/src/components/DialogTorrentDetailsContent/TorrentCache/snakeSettings.js index a45f514..a567066 100644 --- a/web/src/components/DialogTorrentDetailsContent/TorrentCache/snakeSettings.js +++ b/web/src/components/DialogTorrentDetailsContent/TorrentCache/snakeSettings.js @@ -1,4 +1,4 @@ -import { themeColors } from 'style/colors' +import { mainColors } from 'style/colors' export const snakeSettings = { default: { @@ -6,7 +6,7 @@ export const snakeSettings = { pieceSize: 14, gapBetweenPieces: 3, borderColor: '#dbf2e8', - completeColor: themeColors.primary, + completeColor: mainColors.primary, backgroundColor: '#fff', progressColor: '#b3dfc9', readerColor: '#000', diff --git a/web/src/components/TorrentList/AddFirstTorrent.jsx b/web/src/components/TorrentList/AddFirstTorrent.jsx index 296f91b..f2d856d 100644 --- a/web/src/components/TorrentList/AddFirstTorrent.jsx +++ b/web/src/components/TorrentList/AddFirstTorrent.jsx @@ -1,6 +1,6 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' -import { themeColors } from 'style/colors' +import { mainColors } from 'style/colors' import AddDialog from '../Add/AddDialog' import IconWrapper from './style' @@ -17,7 +17,7 @@ export default function AddFirstTorrent() { diff --git a/web/src/components/TorrentList/NoServerConnection.jsx b/web/src/components/TorrentList/NoServerConnection.jsx index 89a2090..ce354d3 100644 --- a/web/src/components/TorrentList/NoServerConnection.jsx +++ b/web/src/components/TorrentList/NoServerConnection.jsx @@ -1,5 +1,5 @@ import { useTranslation } from 'react-i18next' -import { themeColors } from 'style/colors' +import { mainColors } from 'style/colors' import IconWrapper from './style' @@ -11,7 +11,7 @@ export default function NoServerConnection() { diff --git a/web/src/style/materialUISetup.js b/web/src/style/materialUISetup.js index d365ec4..8d169d6 100644 --- a/web/src/style/materialUISetup.js +++ b/web/src/style/materialUISetup.js @@ -4,17 +4,24 @@ import { useMemo } from 'react' import { mainColors } from './colors' +const primary = { main: mainColors.primary } +const typography = { fontFamily: 'Open Sans, sans-serif' } + // https://material-ui.com/ru/customization/default-theme/ export const darkTheme = createMuiTheme({ + typography, palette: { type: 'dark', background: { paper: '#575757' }, + primary, }, }) export const lightTheme = createMuiTheme({ + typography, palette: { type: 'light', background: { paper: '#f1f1f1' }, + primary, }, }) @@ -24,11 +31,11 @@ export const useMaterialUITheme = () => { const muiTheme = useMemo( () => createMuiTheme({ + typography, palette: { type: isDarkMode ? 'dark' : 'light', - primary: { main: mainColors.primary }, + primary, }, - typography: { fontFamily: 'Open Sans, sans-serif' }, }), [isDarkMode], )