Skip to content

Commit 6ccac6e

Browse files
committed
Mobile improvements for two-factor form
1 parent 9a0ed6b commit 6ccac6e

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

resources/scripts/components/dashboard/forms/ConfigureTwoFactorForm.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ export default () => {
1010

1111
return user.useTotp ?
1212
<div>
13-
{visible && <DisableTwoFactorModal visible={visible} onDismissed={() => setVisible(false)}/>}
13+
{visible &&
14+
<DisableTwoFactorModal
15+
appear={true}
16+
visible={visible}
17+
onDismissed={() => setVisible(false)}
18+
/>
19+
}
1420
<p className={'text-sm'}>
1521
Two-factor authentication is currently enabled on your account.
1622
</p>
@@ -25,7 +31,13 @@ export default () => {
2531
</div>
2632
:
2733
<div>
28-
{visible && <SetupTwoFactorModal visible={visible} onDismissed={() => setVisible(false)}/>}
34+
{visible &&
35+
<SetupTwoFactorModal
36+
appear={true}
37+
visible={visible}
38+
onDismissed={() => setVisible(false)}
39+
/>
40+
}
2941
<p className={'text-sm'}>
3042
You do not currently have two-factor authentication enabled on your account. Click
3143
the button below to begin configuring it.

resources/scripts/components/dashboard/forms/SetupTwoFactorModal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ export default ({ ...props }: RequiredModalProps) => {
6363
>
6464
<Form className={'mb-0'}>
6565
<FlashMessageRender className={'mb-6'} byKey={'account:two-factor'}/>
66-
<div className={'flex'}>
67-
<div className={'flex-1'}>
68-
<div className={'w-64 h-64 bg-neutral-600 p-2 rounded'}>
66+
<div className={'flex flex-wrap'}>
67+
<div className={'w-full md:flex-1'}>
68+
<div className={'w-32 h-32 md:w-64 md:w-64 bg-neutral-600 p-2 rounded mx-auto'}>
6969
{!token || !token.length ?
7070
<img
7171
src={'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='}
@@ -80,7 +80,7 @@ export default ({ ...props }: RequiredModalProps) => {
8080
}
8181
</div>
8282
</div>
83-
<div className={'flex-1 flex flex-col'}>
83+
<div className={'w-full mt-6 md:mt-0 md:flex-1 md:flex md:flex-col'}>
8484
<div className={'flex-1'}>
8585
<Field
8686
id={'code'}
@@ -91,7 +91,7 @@ export default ({ ...props }: RequiredModalProps) => {
9191
autoFocus={!loading}
9292
/>
9393
</div>
94-
<div className={'text-right'}>
94+
<div className={'mt-6 md:mt-0 text-right'}>
9595
<button className={'btn btn-primary btn-sm'} disabled={!isValid}>
9696
Setup
9797
</button>

resources/scripts/components/elements/Modal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Spinner from '@/components/elements/Spinner';
77
export interface RequiredModalProps {
88
visible: boolean;
99
onDismissed: () => void;
10+
appear?: boolean;
1011
}
1112

1213
type Props = RequiredModalProps & {
@@ -38,6 +39,7 @@ export default (props: Props) => {
3839
<CSSTransition
3940
timeout={250}
4041
classNames={'fade'}
42+
appear={props.appear}
4143
in={render}
4244
unmountOnExit={true}
4345
onExited={() => props.onDismissed()}

0 commit comments

Comments
 (0)