feat: updated the settings page to be a bit more consistent with the rest of the design (#208)

This commit is contained in:
Vojtech Simetka
2021-10-04 12:26:34 +02:00
committed by GitHub
parent 57f5a73f3a
commit b69e368f69
+17 -16
View File
@@ -1,8 +1,19 @@
import { ReactElement, useState, useContext } from 'react' import { ReactElement, useState, useContext } from 'react'
import { Paper, TextField, Typography, Button } from '@material-ui/core' import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'
import { TextField, Typography, Button } from '@material-ui/core'
import { Context as SettingsContext } from '../../providers/Settings' import { Context as SettingsContext } from '../../providers/Settings'
const useStyles = makeStyles((theme: Theme) =>
createStyles({
item: {
margin: 0,
marginTop: theme.spacing(4),
},
}),
)
export default function Settings(): ReactElement { export default function Settings(): ReactElement {
const classes = useStyles()
const { apiUrl, apiDebugUrl, setApiUrl, setDebugApiUrl } = useContext(SettingsContext) const { apiUrl, apiDebugUrl, setApiUrl, setDebugApiUrl } = useContext(SettingsContext)
const [host, setHost] = useState(apiUrl) const [host, setHost] = useState(apiUrl)
const [debugHost, setDebugHost] = useState(apiDebugUrl) const [debugHost, setDebugHost] = useState(apiDebugUrl)
@@ -20,12 +31,10 @@ export default function Settings(): ReactElement {
<Typography variant="h4" gutterBottom> <Typography variant="h4" gutterBottom>
Settings Settings
</Typography> </Typography>
<Paper>
<TextField <TextField
label="API Endpoint" label="API Endpoint"
style={{ margin: 0 }} className={classes.item}
placeholder="ex: 127.0.0.0.1:1633" placeholder="ex: 127.0.0.0.1:1633"
helperText="Enter node host override / port"
fullWidth fullWidth
defaultValue={apiUrl} defaultValue={apiUrl}
margin="normal" margin="normal"
@@ -35,15 +44,11 @@ export default function Settings(): ReactElement {
onChange={e => { onChange={e => {
setHost(e.target.value) setHost(e.target.value)
}} }}
variant="filled"
/> />
</Paper>
<Paper style={{ marginTop: '20px' }}>
<TextField <TextField
label="Debug API Endpoint" label="Debug API Endpoint"
style={{ margin: 0 }} className={classes.item}
placeholder="ex: 127.0.0.0.1:1635" placeholder="ex: 127.0.0.0.1:1635"
helperText="Enter node debug host override / port"
fullWidth fullWidth
defaultValue={apiDebugUrl} defaultValue={apiDebugUrl}
onChange={e => { onChange={e => {
@@ -53,16 +58,12 @@ export default function Settings(): ReactElement {
InputLabelProps={{ InputLabelProps={{
shrink: true, shrink: true,
}} }}
variant="filled"
/> />
</Paper> {touched && (
{touched ? ( <Button variant="outlined" color="primary" className={classes.item} onClick={submit}>
<div style={{ marginTop: '20px' }}>
<Button variant="outlined" color="primary" onClick={submit}>
Save Save
</Button> </Button>
</div> )}
) : null}
</> </>
) )
} }