Skip to content
Snippets Groups Projects
Commit b9a7baea authored by Léopold Chappuis's avatar Léopold Chappuis Committed by Léopold Chappuis
Browse files

settings: update UI for General Settings

wrapped in a Card

Change-Id: I9b8038b0ca6b859808f946d33b14f422bcadc322
parent afc39465
Branches
Tags
No related merge requests found
...@@ -15,9 +15,10 @@ ...@@ -15,9 +15,10 @@
* License along with this program. If not, see * License along with this program. If not, see
* <https://www.gnu.org/licenses/>. * <https://www.gnu.org/licenses/>.
*/ */
import { Box, Stack, useMediaQuery, useTheme } from '@mui/material' import { Box, Stack } from '@mui/material'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import LayoutSettings from '../LayoutSettings'
import { SettingsGroup } from '../Settings' import { SettingsGroup } from '../Settings'
import SettingLanguage from './SettingLanguage' import SettingLanguage from './SettingLanguage'
import SettingLinkPreview from './SettingLinkPreview' import SettingLinkPreview from './SettingLinkPreview'
...@@ -27,14 +28,12 @@ import SettingTips from './SettingTips' ...@@ -27,14 +28,12 @@ import SettingTips from './SettingTips'
function System() { function System() {
const { t } = useTranslation() const { t } = useTranslation()
const theme = useTheme()
const isMobile: boolean = useMediaQuery(theme.breakpoints.only('xs'))
const marginValue = '10px' const marginValue = '10px'
const style = { mt: marginValue, mb: marginValue } const style = { mt: marginValue, mb: marginValue }
return ( return (
<Box sx={{ display: 'flex', justifyContent: isMobile ? 'center' : 'flex-start', padding: '2%' }}> <LayoutSettings title={t('general_settings')} disableMarginTop={true}>
<Stack <Stack
sx={{ sx={{
padding: '3%', padding: '3%',
...@@ -59,7 +58,7 @@ function System() { ...@@ -59,7 +58,7 @@ function System() {
</Box> </Box>
</SettingsGroup> </SettingsGroup>
</Stack> </Stack>
</Box> </LayoutSettings>
) )
} }
......
...@@ -22,9 +22,10 @@ interface LayoutSettingsProps { ...@@ -22,9 +22,10 @@ interface LayoutSettingsProps {
children: React.ReactNode children: React.ReactNode
title: string title: string
text?: string text?: string
disableMarginTop?: boolean
} }
export default function LayoutSettings({ children, title, text }: LayoutSettingsProps) { export default function LayoutSettings({ children, title, text, disableMarginTop }: LayoutSettingsProps) {
const theme = useTheme() const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down('sm')) const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
...@@ -45,17 +46,25 @@ export default function LayoutSettings({ children, title, text }: LayoutSettings ...@@ -45,17 +46,25 @@ export default function LayoutSettings({ children, title, text }: LayoutSettings
padding: '20px', padding: '20px',
boxShadow: isMobile ? 'none' : undefined, boxShadow: isMobile ? 'none' : undefined,
border: isMobile ? 'none' : undefined, border: isMobile ? 'none' : undefined,
backgroundColor: isMobile ? theme.ChatInterface.backgroundColor : 'unset',
}} }}
> >
<CardHeader <CardHeader
title={<Typography variant="h5">{title}</Typography>} title={<Typography variant="h5">{title}</Typography>}
subheader={ subheader={
<Box sx={{ mt: '40px' }}> <Box sx={{ mt: disableMarginTop ? '0px' : '40px' }}>
<Typography variant="body2">{text}</Typography> <Typography variant="body2">{text}</Typography>
</Box> </Box>
} }
/> />
<Box sx={{ marginTop: '50px', maxWidth: '100%', display: 'flex', justifyContent: 'center' }}> <Box
sx={{
marginTop: disableMarginTop ? '0px' : '50px',
maxWidth: '100%',
display: 'flex',
justifyContent: 'center',
}}
>
<Box sx={{ maxWidth: '90%' }}>{children}</Box> <Box sx={{ maxWidth: '90%' }}>{children}</Box>
</Box> </Box>
</Card> </Card>
......
...@@ -90,7 +90,12 @@ interface SettingGroupProps { ...@@ -90,7 +90,12 @@ interface SettingGroupProps {
export const SettingsGroup = ({ label, children }: SettingGroupProps) => { export const SettingsGroup = ({ label, children }: SettingGroupProps) => {
return ( return (
<List sx={{ width: '250px' }} subheader={<ListSubheader sx={{ paddingLeft: 0 }}>{label}</ListSubheader>}> <List
sx={{ minWidth: '250px' }}
subheader={
<ListSubheader sx={{ paddingLeft: 0, backgroundColor: 'inherit', fontSize: '18px' }}>{label}</ListSubheader>
}
>
{children} {children}
</List> </List>
) )
......
...@@ -32,6 +32,7 @@ declare module '@mui/material/styles' { ...@@ -32,6 +32,7 @@ declare module '@mui/material/styles' {
replyBorderColor: string replyBorderColor: string
messageReplyColor: string messageReplyColor: string
reactionModalBackground: string reactionModalBackground: string
backgroundColor: string
} }
LoginPage: { LoginPage: {
backgroundColor: string backgroundColor: string
...@@ -254,6 +255,7 @@ const palettes = { ...@@ -254,6 +255,7 @@ const palettes = {
replyBorderColor: '2px solid white', replyBorderColor: '2px solid white',
messageReplyColor: '#D3D3D3', messageReplyColor: '#D3D3D3',
reactionModalBackground: 'lightgrey', reactionModalBackground: 'lightgrey',
backgroundColor: 'white',
}, },
LoginPage: { LoginPage: {
backgroundColor: '#f9fafc', backgroundColor: '#f9fafc',
...@@ -356,6 +358,7 @@ const palettes = { ...@@ -356,6 +358,7 @@ const palettes = {
replyBorderColor: '3px solid #121212', replyBorderColor: '3px solid #121212',
messageReplyColor: '#404040', messageReplyColor: '#404040',
reactionModalBackground: '#1e1f1e', reactionModalBackground: '#1e1f1e',
backgroundColor: '#050505',
}, },
LoginPage: { LoginPage: {
backgroundColor: '#f9fafc', backgroundColor: '#f9fafc',
......
...@@ -136,6 +136,7 @@ ...@@ -136,6 +136,7 @@
"file_not_downloaded": "File not downloaded on the server, please download the file before sharing.", "file_not_downloaded": "File not downloaded on the server, please download the file before sharing.",
"find_contacts": "Find contacts", "find_contacts": "Find contacts",
"find_users_and_conversations": "Search…", "find_users_and_conversations": "Search…",
"general_settings": "General",
"go_to_conversation": "Jump to conversation", "go_to_conversation": "Jump to conversation",
"getting_name_server_error": "An error occurred while attempting to retrieve the name server.", "getting_name_server_error": "An error occurred while attempting to retrieve the name server.",
"getting_oauth_clients_error": "An error occurred while attempting to retrieve the OAuth clients.", "getting_oauth_clients_error": "An error occurred while attempting to retrieve the OAuth clients.",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment