on master help sign in
devex: inline style --> scss; use color var
commit8b7f431a102ac1074342e8abbe66b364499b4be7 authortomholford <tomholford@users.noreply.github.com> dateSun 7 Nov 2021, 18:23 (5 years ago) parent776b805
4 files changed+94−50
src/form/Inputs.tsx+7−1 src/style/shared/variables.scss+2 src/views/Activate/MasterKeyConfirm.scss+73 src/views/Activate/MasterKeyConfirm.tsx+12−49
src/form/Inputs.tsx+7−1
@@ -216,11 +216,16 @@ export function EmailInput({ ...rest }) {
216216}
217217
218218type TicketSegmentInputProps = {
219+ className?: string;
219220 name: string;
220221 rest: StatelessTextInputProps;
221222};
222223
223−export function TicketSegmentInput({ name, ...rest }: TicketSegmentInputProps) {
224+export function TicketSegmentInput({
225+ className,
226+ name,
227+ ...rest
228+}: TicketSegmentInputProps) {
224229 const { input } = useField(name);
225230 const { change } = useForm();
226231
@@ -276,6 +281,7 @@ export function TicketSegmentInput({ name, ...rest }: TicketSegmentInputProps) {
276281
277282 return (
278283 <StatelessTextInput
284+ className={className}
279285 {...mergedInput}
280286 autoCapitalize="none"
281287 autoCorrect="off"
src/style/shared/variables.scss+2
@@ -13,3 +13,5 @@ $accept-green: rgba(0, 159, 101, 1);
1313$warning-red: rgb(242, 33, 33);
1414$light-gray-border: 1px solid $light-gray;
1515$activate-blue: rgba(33, 157, 255, 1);
16+$activate-error-red: #ff4136;
17+
src/views/Activate/MasterKeyConfirm.scssnew file+73
@@ -0,0 +1,73 @@
1+@import 'style/shared/variables';
2+
3+#master-key-confirm {
4+ .content {
5+ align-items: center;
6+ display: flex;
7+ flex-direction: column;
8+ flex-wrap: nowrap;
9+ height: 100%;
10+ justify-content: center;
11+ }
12+
13+ .form-inner {
14+ display: grid;
15+ grid-template-areas: 'inputs' 'submit';
16+ grid-template-columns: 1fr;
17+ grid-template-rows: 80% 20%;
18+ width: 100%;
19+ height: 100%;
20+ }
21+
22+ .inputs-outer {
23+ grid-area: inputs;
24+ display: flex;
25+ flex-direction: column;
26+ flex-wrap: nowrap;
27+ height: 100%;
28+ align-items: center;
29+ justify-content: center;
30+ }
31+
32+ .inputs-inner {
33+ display: flex;
34+ flex-direction: row;
35+ width: 80%;
36+ height: min-content;
37+ margin-top: 16px;
38+ margin-bottom: 16px;
39+ flex-wrap: nowrap;
40+ justify-content: center;
41+ }
42+
43+ .error-message {
44+ color: $activate-error-red;
45+ font-family: Inter;
46+ font-size: 14px;
47+ font-weight: 600;
48+ line-height: 24px;
49+ }
50+
51+ .ticket-input {
52+ width: 75px;
53+ padding-top: 18px;
54+ padding-bottom: 18px;
55+ font-size: 16px;
56+ height: 24px;
57+ font-family: Source Code Pro;
58+ border-radius: 5px;
59+ border-style: solid;
60+ color: black;
61+ border-width: 1px;
62+ border-color: rgba(0, 0, 0, 0.25);
63+ }
64+
65+ .has-error {
66+ border-color: $activate-error-red;
67+ color: $activate-error-red;
68+ background-color: transparentize(
69+ $color: $activate-error-red,
70+ $amount: 0.95
71+ );
72+ }
73+}
src/views/Activate/MasterKeyConfirm.tsx+12−49
@@ -1,5 +1,6 @@
11import React, { useCallback, useMemo, useState } from 'react';
22import * as need from 'lib/need';
3+import cn from 'classnames';
34
45import ActivateView from './ActivateView';
56import { Box, Text } from '@tlon/indigo-react';
@@ -23,6 +24,8 @@ import View from 'components/View';
2324import NavHeader from 'components/NavHeader';
2425import { MiniBackButton } from 'components/MiniBackButton';
2526
27+import './MasterKeyConfirm.scss';
28+
2629const MasterKeyConfirm = () => {
2730 const { derivedWallet, setIsIn } = useActivateFlow();
2831 const { ticket } = need.wallet(derivedWallet);
@@ -90,7 +93,7 @@ const MasterKeyConfirm = () => {
9093 useFadeIn();
9194
9295 return (
93− <View centered={true}>
96+ <View centered={true} id={'master-key-confirm'}>
9497 <NavHeader>
9598 <Box marginBottom={'10px'}>
9699 <MiniBackButton
@@ -105,13 +108,7 @@ const MasterKeyConfirm = () => {
105108 header={header}
106109 gridRows={'20% 80%'}
107110 gridAreas={"'header' 'content'"}>
108− <Box
109− alignItems={'center'}
110− display={'flex'}
111− flexDirection={'column'}
112− flexWrap={'nowrap'}
113− height={'100%'}
114− justifyContent={'center'}>
111+ <Box className={'content'}>
115112 <BridgeForm
116113 style={{
117114 display: 'flex',
@@ -126,34 +123,14 @@ const MasterKeyConfirm = () => {
126123 onValues={onValues}
127124 initialValues={initialValues}>
128125 {({ handleSubmit, valid }) => (
129− <Box
130− display={'grid'}
131− gridTemplateAreas={"'inputs' 'submit'"}
132− gridTemplateColumns={'1fr'}
133− gridTemplateRows={'80% 20%'}
134− width={'100%'}
135− height={'100%'}>
136− <Box
137− gridArea="inputs"
138− display={'flex'}
139− flexDirection={'column'}
140− flexWrap={'nowrap'}
141− height={'100%'}
142− alignItems={'center'}
143− justifyContent={'center'}>
126+ <Box className="form-inner">
127+ <Box className="inputs-outer">
144128 {showError && (
145129 <Box height={'24px'}>
146130 {/* this is a flexbox placeholder to balance the error message below*/}
147131 </Box>
148132 )}
149− <Box
150− display={'flex'}
151− flexDirection={'row'}
152− width={'80%'}
153− height={'min-content'}
154− marginY={'16px'}
155− flexWrap={'nowrap'}
156− justifyContent={'center'}>
133+ <Box className="inputs-inner">
157134 {ticketSegments.map((segment, i) => {
158135 return (
159136 <Box
@@ -162,18 +139,9 @@ const MasterKeyConfirm = () => {
162139 flexDirection={'row'}
163140 flexWrap={'nowrap'}>
164141 <TicketSegmentInput
165− width={'75px'}
166− paddingY={'18px'}
167− fontSize={'16px'}
168− height={'24px'}
169− fontFamily={'Source Code Pro'}
170− borderRadius={'5px'}
171− border={'solid 1px rgba(0,0,0,0.25)'}
172− borderColor={
173− showError ? '#FF4136' : 'rgba(0,0,0,0.25)'
174− }
175− color={showError ? '#FF4136' : 'rgba(0,0,0,0.95)'}
176− backgroundColor={showError ? '#FF41360D' : '#FFF'}
142+ className={cn('ticket-input', {
143+ 'has-error': showError,
144+ })}
177145 name={`ticket${i}`}
178146 autoFocus={i === 0}
179147 />
@@ -192,12 +160,7 @@ const MasterKeyConfirm = () => {
192160 </Box>
193161 {showError && (
194162 <Box>
195− <Text
196− color={'#FF4136'}
197− fontFamily={'Inter'}
198− fontSize={'14px'}
199− fontWeight={'600'}
200− lineHeight={'24px'}>
163+ <Text className="error-message">
201164 The Master Ticket you entered is incorrect
202165 </Text>
203166 </Box>