From 500207f7b8ca31a7c4544e825a205be9999528a4 Mon Sep 17 00:00:00 2001 From: Deluan Date: Tue, 31 Mar 2020 09:05:46 -0400 Subject: [PATCH] refactor: extract themes to their own folder --- ui/src/App.js | 3 ++- ui/src/layout/Login.js | 2 +- ui/src/layout/Themes.js | 39 --------------------------------------- ui/src/layout/index.js | 3 +-- ui/src/themes/dark.js | 18 ++++++++++++++++++ ui/src/themes/index.js | 4 ++++ ui/src/themes/light.js | 20 ++++++++++++++++++++ 7 files changed, 46 insertions(+), 43 deletions(-) create mode 100644 ui/src/themes/dark.js create mode 100644 ui/src/themes/index.js create mode 100644 ui/src/themes/light.js diff --git a/ui/src/App.js b/ui/src/App.js index 7643d98c1..6a8a466a0 100644 --- a/ui/src/App.js +++ b/ui/src/App.js @@ -4,7 +4,8 @@ import dataProvider from './dataProvider' import authProvider from './authProvider' import polyglotI18nProvider from 'ra-i18n-polyglot' import messages from './i18n' -import { DarkTheme, Layout, Login } from './layout' +import { Layout, Login } from './layout' +import { DarkTheme } from './themes' import transcoding from './transcoding' import player from './player' import user from './user' diff --git a/ui/src/layout/Login.js b/ui/src/layout/Login.js index 873e5a688..d76fef825 100644 --- a/ui/src/layout/Login.js +++ b/ui/src/layout/Login.js @@ -14,7 +14,7 @@ import LockIcon from '@material-ui/icons/Lock' import { Notification, useLogin, useNotify, useTranslate } from 'react-admin' -import { LightTheme } from './Themes' +import { LightTheme } from '../themes' const useStyles = makeStyles((theme) => ({ main: { diff --git a/ui/src/layout/Themes.js b/ui/src/layout/Themes.js index 18a861f58..e69de29bb 100644 --- a/ui/src/layout/Themes.js +++ b/ui/src/layout/Themes.js @@ -1,39 +0,0 @@ -import blue from '@material-ui/core/colors/blue' - -export const DarkTheme = { - palette: { - primary: { - main: '#90caf9' - }, - secondary: blue, - type: 'dark' - }, - overrides: { - MuiFormGroup: { - root: { - color: 'white' - } - } - } -} - -export const LightTheme = { - palette: { - secondary: { - light: '#5f5fc4', - main: '#283593', - dark: '#001064', - contrastText: '#fff' - } - }, - overrides: { - MuiFilledInput: { - root: { - backgroundColor: 'rgba(0, 0, 0, 0.04)', - '&$disabled': { - backgroundColor: 'rgba(0, 0, 0, 0.04)' - } - } - } - } -} diff --git a/ui/src/layout/index.js b/ui/src/layout/index.js index fcb2b8517..ebfb0760a 100644 --- a/ui/src/layout/index.js +++ b/ui/src/layout/index.js @@ -1,5 +1,4 @@ import Login from './Login' import Layout from './Layout' -import { DarkTheme, LightTheme } from './Themes' -export { Layout, Login, DarkTheme, LightTheme } +export { Layout, Login } diff --git a/ui/src/themes/dark.js b/ui/src/themes/dark.js new file mode 100644 index 000000000..ed7f4a404 --- /dev/null +++ b/ui/src/themes/dark.js @@ -0,0 +1,18 @@ +import blue from '@material-ui/core/colors/blue' + +export default { + palette: { + primary: { + main: '#90caf9' + }, + secondary: blue, + type: 'dark' + }, + overrides: { + MuiFormGroup: { + root: { + color: 'white' + } + } + } +} diff --git a/ui/src/themes/index.js b/ui/src/themes/index.js new file mode 100644 index 000000000..bb9812739 --- /dev/null +++ b/ui/src/themes/index.js @@ -0,0 +1,4 @@ +import LightTheme from './light' +import DarkTheme from './dark' + +export { LightTheme, DarkTheme } diff --git a/ui/src/themes/light.js b/ui/src/themes/light.js new file mode 100644 index 000000000..a4a99b0f2 --- /dev/null +++ b/ui/src/themes/light.js @@ -0,0 +1,20 @@ +export default { + palette: { + secondary: { + light: '#5f5fc4', + main: '#283593', + dark: '#001064', + contrastText: '#fff' + } + }, + overrides: { + MuiFilledInput: { + root: { + backgroundColor: 'rgba(0, 0, 0, 0.04)', + '&$disabled': { + backgroundColor: 'rgba(0, 0, 0, 0.04)' + } + } + } + } +}