@@ -9,6 +9,8 @@ import { ApplicationStore } from '@/state';
99import { httpErrorToHuman } from '@/api/http' ;
1010import FlashMessageRender from '@/components/FlashMessageRender' ;
1111import Field from '@/components/elements/Field' ;
12+ import tw from 'twin.macro' ;
13+ import Button from '@/components/elements/Button' ;
1214
1315interface Values {
1416 code : string ;
@@ -64,7 +66,7 @@ export default ({ onDismissed, ...props }: RequiredModalProps) => {
6466 . matches ( / ^ ( \d ) { 6 } $ / , 'Authenticator code must be 6 digits.' ) ,
6567 } ) }
6668 >
67- { ( { isSubmitting, isValid } ) => (
69+ { ( { isSubmitting } ) => (
6870 < Modal
6971 { ...props }
7072 onDismissed = { dismiss }
@@ -75,47 +77,47 @@ export default ({ onDismissed, ...props }: RequiredModalProps) => {
7577 >
7678 { recoveryTokens . length > 0 ?
7779 < >
78- < h2 className = { ' mb-4' } > Two-factor authentication enabled</ h2 >
79- < p className = { ' text-neutral-300' } >
80+ < h2 css = { tw `text-2xl mb-4` } > Two-factor authentication enabled</ h2 >
81+ < p css = { tw ` text-neutral-300` } >
8082 Two-factor authentication has been enabled on your account. Should you loose access to
81- this device you' ll need to use on of the codes displayed below in order to access your
83+ this device you' ll need to use on of the codes displayed below in order to access your
8284 account.
8385 </ p >
84- < p className = { ' text-neutral-300 mt-4' } >
86+ < p css = { tw ` text-neutral-300 mt-4` } >
8587 < strong > These codes will not be displayed again.</ strong > Please take note of them now
8688 by storing them in a secure repository such as a password manager.
8789 </ p >
88- < pre className = { ' mt-4 rounded font-mono bg-neutral-900 p-4' } >
89- { recoveryTokens . map ( token => < code key = { token } className = { ' block mb-1' } > { token } </ code > ) }
90+ < pre css = { tw `text-sm mt-4 rounded font-mono bg-neutral-900 p-4` } >
91+ { recoveryTokens . map ( token => < code key = { token } css = { tw ` block mb-1` } > { token } </ code > ) }
9092 </ pre >
91- < div className = { ' text-right' } >
92- < button className = { ' mt-6 btn btn-lg btn-primary '} onClick = { dismiss } >
93+ < div css = { tw ` text-right` } >
94+ < Button css = { tw ` mt-6` } size = { 'large '} onClick = { dismiss } >
9395 Close
94- </ button >
96+ </ Button >
9597 </ div >
9698 </ >
9799 :
98- < Form className = { ' mb-0' } >
99- < FlashMessageRender className = { ' mb-6' } byKey = { 'account:two-factor' } />
100- < div className = { ' flex flex-wrap' } >
101- < div className = { ' w-full md:flex-1' } >
102- < div className = { ' w-32 h-32 md:w-64 md:h-64 bg-neutral-600 p-2 rounded mx-auto' } >
100+ < Form css = { tw ` mb-0` } >
101+ < FlashMessageRender css = { tw ` mb-6` } byKey = { 'account:two-factor' } />
102+ < div css = { tw ` flex flex-wrap` } >
103+ < div css = { tw ` w-full md:flex-1` } >
104+ < div css = { tw ` w-32 h-32 md:w-64 md:h-64 bg-neutral-600 p-2 rounded mx-auto` } >
103105 { ! token || ! token . length ?
104106 < img
105107 src = { 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=' }
106- className = { ' w-64 h-64 rounded' }
108+ css = { tw ` w-64 h-64 rounded` }
107109 />
108110 :
109111 < img
110112 src = { `https://api.qrserver.com/v1/create-qr-code/?size=500x500&data=${ token } ` }
111113 onLoad = { ( ) => setLoading ( false ) }
112- className = { ' w-full h-full shadow-none rounded-0' }
114+ css = { tw ` w-full h-full shadow-none rounded-none` }
113115 />
114116 }
115117 </ div >
116118 </ div >
117- < div className = { ' w-full mt-6 md:mt-0 md:flex-1 md:flex md:flex-col' } >
118- < div className = { ' flex-1' } >
119+ < div css = { tw ` w-full mt-6 md:mt-0 md:flex-1 md:flex md:flex-col` } >
120+ < div css = { tw ` flex-1` } >
119121 < Field
120122 id = { 'code' }
121123 name = { 'code' }
@@ -125,10 +127,10 @@ export default ({ onDismissed, ...props }: RequiredModalProps) => {
125127 autoFocus = { ! loading }
126128 />
127129 </ div >
128- < div className = { ' mt-6 md:mt-0 text-right' } >
129- < button className = { 'btn btn-primary btn-sm' } disabled = { ! isValid } >
130+ < div css = { tw ` mt-6 md:mt-0 text-right` } >
131+ < Button >
130132 Setup
131- </ button >
133+ </ Button >
132134 </ div >
133135 </ div >
134136 </ div >
0 commit comments