ux: creation of a menu in the user settings

This commit is contained in:
bsourisse 2023-03-06 19:19:28 +01:00
parent d50f87972c
commit 3433f37a0e
5 changed files with 135 additions and 13 deletions

View file

@ -107,7 +107,7 @@ export default function EmailSettings(props) {
)}
</p>
<button
className='defaultButton'
className={classes.AccountSettingsButton}
disabled={!isValid || isSubmitting}
>
{isLoading ? (

View file

@ -106,7 +106,7 @@ export default function PasswordSettings(props) {
)}
</p>
<button
className='defaultButton'
className={classes.AccountSettingsButton}
disabled={!isValid || isSubmitting}
>
{isLoading ? (

View file

@ -1,6 +1,7 @@
//Lib
import 'react-toastify/dist/ReactToastify.css';
import classes from './UserSettings.module.css';
import { useState } from 'react';
//Components
import EmailSettings from './EmailSettings/EmailSettings';
@ -10,21 +11,57 @@ import EmailAlertSettings from './EmailAlertSettings/EmailAlertSettings';
import AppriseAlertSettings from './AppriseAlertSettings/AppriseAlertSettings';
export default function UserSettings(props) {
//States
const [tab, setTab] = useState('General');
return (
<div className={classes.containerSettings}>
<div>
<h1 style={{ color: '#494b7a', textAlign: 'center' }}>
Welcome{' '}
{props.status === 'authenticated' && props.data.user.name}{' '}
👋
<h1
style={{
color: '#494b7a',
textAlign: 'left',
marginLeft: '30px',
}}
>
Account{' '}
</h1>
</div>
<PasswordSettings username={props.data.user.name} />
<EmailSettings email={props.data.user.email} />
<UsernameSettings username={props.data.user.name} />
<EmailAlertSettings />
<AppriseAlertSettings />
<div className={classes.tabList}>
<button
className={
tab == 'General'
? classes.tabListButtonActive
: classes.tabListButton
}
onClick={() => setTab('General')}
>
General
</button>
<button
className={
tab == 'Notifications'
? classes.tabListButtonActive
: classes.tabListButton
}
onClick={() => setTab('Notifications')}
>
Notifications
</button>
</div>
{tab == 'General' && (
<>
<PasswordSettings username={props.data.user.name} />
<EmailSettings email={props.data.user.email} />
<UsernameSettings username={props.data.user.name} />{' '}
</>
)}
{tab == 'Notifications' && (
<>
<EmailAlertSettings />
<AppriseAlertSettings />
</>
)}
</div>
);
}

View file

@ -161,3 +161,88 @@
animation: entrance 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
font-weight: 300;
}
.tabList {
display: flex;
}
.tabListButton {
color: #494b7a;
padding: 12px 0px;
min-height: 48px;
overflow: hidden;
text-align: center;
flex-direction: column;
font-size: 1em;
font-weight: 500;
line-height: 1.71;
text-transform: none;
align-items: center;
cursor: pointer;
vertical-align: middle;
text-decoration: none;
border: 0;
background-color: transparent;
margin-left: 30px;
border-bottom: 2px solid transparent;
}
.tabListButton:hover {
color: #6d4aff;
border-bottom: 2px solid #6d4aff;
}
.tabListButtonActive {
color: #6d4aff;
border: 0;
border-bottom: 2px solid #6d4aff;
padding: 12px 0px;
min-height: 48px;
overflow: hidden;
text-align: center;
flex-direction: column;
font-size: 1em;
font-weight: 500;
line-height: 1.71;
text-transform: none;
align-items: center;
cursor: pointer;
vertical-align: middle;
text-decoration: none;
background-color: transparent;
margin-left: 30px;
}
.AccountSettingsButton {
border: 0;
padding: 10px 15px;
background-color: #6d4aff;
color: white;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
font-size: 1em;
}
.AccountSettingsButton:hover {
border: 0;
padding: 10px 15px;
background-color: #4f31ce;
color: white;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
font-size: 1em;
}
.AccountSettingsButton:active {
border: 0;
padding: 10px 15px;
background-color: #4f31ce;
color: white;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
font-size: 1em;
transform: scale(0.95);
}

View file

@ -116,7 +116,7 @@ export default function UsernameSettings(props) {
)}
</p>
<button
className='defaultButton'
className={classes.AccountSettingsButton}
disabled={!isValid || isSubmitting}
>
{isLoading ? (