feat: migrate session inputs on registration screen to the new component

still need to do the slide animation
pull/3056/head
William Grant 2 years ago
parent a426d789e9
commit 18f5df6fd5

@ -77,75 +77,71 @@
@include registration-label-mixin; @include registration-label-mixin;
text-align: center; text-align: center;
} }
&__entry-fields {
margin: 0px;
padding-bottom: 30px;
}
}
&-input-floating-label-show-hide {
padding-inline-end: 30px;
}
&-input-with-label-container {
height: 46.5px;
width: 280px;
font-family: var(--font-default);
color: var(--text-primary-color);
padding: 2px 0 2px 0;
transition: opacity var(--default-duration);
opacity: 1;
position: relative;
label {
line-height: 14px;
opacity: 0;
color: var(--text-primary-color);
font-size: 10px;
line-height: 11px;
position: absolute;
top: 0px;
}
&.filled {
opacity: 1;
}
&.error {
color: var(--danger-color);
} }
input { // TODO[epic=ses-50]: Remove the following styles
border: none; // &-input-floating-label-show-hide {
outline: 0; // padding-inline-end: 30px;
height: 14px; // }
width: 280px;
background: transparent; // &-input-with-label-container {
color: var(--input-text-color); // height: 46.5px;
// width: 280px;
font-family: var(--font-default); // font-family: var(--font-default);
font-size: 12px; // color: var(--text-primary-color);
line-height: 14px;
position: absolute; // padding: 2px 0 2px 0;
top: 50%; // transition: opacity var(--default-duration);
transform: translateY(-50%); // opacity: 1;
// position: relative;
&::placeholder {
color: var(--input-text-placeholder-color); // label {
} // line-height: 14px;
} // opacity: 0;
// color: var(--text-primary-color);
hr {
border: 1px solid var(--border-color); // font-size: 10px;
// line-height: 11px;
width: 100%; // position: absolute;
position: absolute; // top: 0px;
bottom: 0px; // }
}
} // &.filled {
// opacity: 1;
// }
// &.error {
// color: var(--danger-color);
// }
// input {
// border: none;
// outline: 0;
// height: 14px;
// width: 280px;
// background: transparent;
// color: var(--input-text-color);
// font-family: var(--font-default);
// font-size: 12px;
// line-height: 14px;
// position: absolute;
// top: 50%;
// transform: translateY(-50%);
// &::placeholder {
// color: var(--input-text-placeholder-color);
// }
// }
// hr {
// border: 1px solid var(--border-color);
// width: 100%;
// position: absolute;
// bottom: 0px;
// }
// }
&-terms-conditions-agreement { &-terms-conditions-agreement {
padding-top: var(--margins-md); padding-top: var(--margins-md);

@ -1,7 +1,6 @@
import classNames from 'classnames';
import { MAX_USERNAME_BYTES } from '../../session/constants'; import { MAX_USERNAME_BYTES } from '../../session/constants';
import { SessionInput } from '../basic/SessionInput'; import { SpacerLG } from '../basic/Text';
import { SessionInput2 } from '../inputs';
const DisplayNameInput = (props: { const DisplayNameInput = (props: {
stealAutoFocus?: boolean; stealAutoFocus?: boolean;
@ -10,9 +9,8 @@ const DisplayNameInput = (props: {
handlePressEnter: () => any; handlePressEnter: () => any;
}) => { }) => {
return ( return (
<SessionInput <SessionInput2
autoFocus={props.stealAutoFocus || false} autoFocus={props.stealAutoFocus || false}
label={window.i18n('displayName')}
type="text" type="text"
placeholder={window.i18n('enterDisplayName')} placeholder={window.i18n('enterDisplayName')}
value={props.displayName} value={props.displayName}
@ -31,8 +29,7 @@ const RecoveryPhraseInput = (props: {
stealAutoFocus?: boolean; stealAutoFocus?: boolean;
}) => { }) => {
return ( return (
<SessionInput <SessionInput2
label={window.i18n('recoveryPhrase')}
type="password" type="password"
value={props.recoveryPhrase} value={props.recoveryPhrase}
autoFocus={props.stealAutoFocus || false} autoFocus={props.stealAutoFocus || false}
@ -60,26 +57,31 @@ export const RegistrationUserDetails = (props: Props) => {
if (props.showSeedField && (props.recoveryPhrase === undefined || !props.onSeedChanged)) { if (props.showSeedField && (props.recoveryPhrase === undefined || !props.onSeedChanged)) {
throw new Error('if show seed is true, we need callback + value'); throw new Error('if show seed is true, we need callback + value');
} }
return ( return (
<div className={classNames('session-registration__entry-fields')}> <div style={{ margin: 0 }}>
{props.showSeedField && ( {props.showSeedField && (
<>
<RecoveryPhraseInput <RecoveryPhraseInput
recoveryPhrase={props.recoveryPhrase as string} recoveryPhrase={props.recoveryPhrase as string}
handlePressEnter={props.handlePressEnter} handlePressEnter={props.handlePressEnter}
onSeedChanged={props.onSeedChanged as any} onSeedChanged={props.onSeedChanged as any}
stealAutoFocus={props.stealAutoFocus} stealAutoFocus={props.stealAutoFocus}
/> />
<SpacerLG />
</>
)} )}
<div className="inputfields">
{props.showDisplayNameField && ( {props.showDisplayNameField && (
<>
<DisplayNameInput <DisplayNameInput
stealAutoFocus={!props.showSeedField && props.stealAutoFocus} stealAutoFocus={!props.showSeedField && props.stealAutoFocus}
displayName={props.displayName} displayName={props.displayName}
handlePressEnter={props.handlePressEnter} handlePressEnter={props.handlePressEnter}
onDisplayNameChanged={props.onDisplayNameChanged} onDisplayNameChanged={props.onDisplayNameChanged}
/> />
<SpacerLG />
</>
)} )}
</div> </div>
</div>
); );
}; };

@ -151,7 +151,7 @@ export const SignInTab = () => {
{signInMode !== SignInMode.Default && ( {signInMode !== SignInMode.Default && (
<> <>
<GoBackMainMenuButton /> <GoBackMainMenuButton />
<SpacerLG />
<RegistrationUserDetails <RegistrationUserDetails
showDisplayNameField={showDisplayNameField} showDisplayNameField={showDisplayNameField}
showSeedField={true} showSeedField={true}

Loading…
Cancel
Save