Allow theme customizing Login Page (#940)

This commit is contained in:
Samarjeet
2021-03-30 08:55:32 +05:30
committed by GitHub
parent a36a8c2372
commit 1f2b5294c3
2 changed files with 70 additions and 54 deletions
+13 -5
View File
@@ -13,11 +13,12 @@ import Logo from '../icons/android-icon-72x72.png'
import { useLogin, useNotify, useTranslate } from 'react-admin' import { useLogin, useNotify, useTranslate } from 'react-admin'
import Notification from './Notification' import Notification from './Notification'
import LightTheme from '../themes/light' import useCurrentTheme from '../themes/useCurrentTheme'
import config from '../config' import config from '../config'
import { clearQueue } from '../actions' import { clearQueue } from '../actions'
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles(
(theme) => ({
main: { main: {
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
@@ -64,7 +65,10 @@ const useStyles = makeStyles((theme) => ({
actions: { actions: {
padding: '0 1em 1em 1em', padding: '0 1em 1em 1em',
}, },
})) systemNameLink: {},
}),
{ name: 'NDLogin' }
)
const renderInput = ({ const renderInput = ({
meta: { touched, error } = {}, meta: { touched, error } = {},
@@ -100,6 +104,7 @@ const FormLogin = ({ loading, handleSubmit, validate }) => {
href="https://www.navidrome.org" href="https://www.navidrome.org"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className={classes.systemNameLink}
> >
Navidrome Navidrome
</a> </a>
@@ -309,10 +314,13 @@ Login.propTypes = {
// We need to put the ThemeProvider decoration in another component // We need to put the ThemeProvider decoration in another component
// Because otherwise the useStyles() hook used in Login won't get // Because otherwise the useStyles() hook used in Login won't get
// the right theme // the right theme
const LoginWithTheme = (props) => ( const LoginWithTheme = (props) => {
<ThemeProvider theme={createMuiTheme(LightTheme)}> const theme = useCurrentTheme()
return (
<ThemeProvider theme={createMuiTheme(theme)}>
<Login {...props} /> <Login {...props} />
</ThemeProvider> </ThemeProvider>
) )
}
export default LoginWithTheme export default LoginWithTheme
+8
View File
@@ -15,6 +15,14 @@ export default {
color: 'white', color: 'white',
}, },
}, },
NDLogin: {
systemNameLink: {
color: '#fff',
},
icon: {
backgroundColor: 'inherit',
},
},
}, },
player: { player: {
theme: 'dark', theme: 'dark',