kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
RegistrationForm: improve layout
rodzic
165ddc91bd
commit
f0cb0d5594
|
@ -10,7 +10,7 @@ import { accountLookup } from 'soapbox/actions/accounts';
|
||||||
import { register, verifyCredentials } from 'soapbox/actions/auth';
|
import { register, verifyCredentials } from 'soapbox/actions/auth';
|
||||||
import { openModal } from 'soapbox/actions/modals';
|
import { openModal } from 'soapbox/actions/modals';
|
||||||
import BirthdayInput from 'soapbox/components/birthday_input';
|
import BirthdayInput from 'soapbox/components/birthday_input';
|
||||||
import { Form, FormGroup, Input, Textarea } from 'soapbox/components/ui';
|
import { Form, FormGroup, FormActions, Button, Input, Textarea } from 'soapbox/components/ui';
|
||||||
import CaptchaField from 'soapbox/features/auth_login/components/captcha';
|
import CaptchaField from 'soapbox/features/auth_login/components/captcha';
|
||||||
import { Checkbox } from 'soapbox/features/forms';
|
import { Checkbox } from 'soapbox/features/forms';
|
||||||
import { useAppSelector, useAppDispatch, useSettings, useFeatures } from 'soapbox/hooks';
|
import { useAppSelector, useAppDispatch, useSettings, useFeatures } from 'soapbox/hooks';
|
||||||
|
@ -228,13 +228,12 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
|
||||||
return (
|
return (
|
||||||
<Form onSubmit={onSubmit} data-testid='registrations-open'>
|
<Form onSubmit={onSubmit} data-testid='registrations-open'>
|
||||||
<fieldset disabled={isLoading} className='space-y-3'>
|
<fieldset disabled={isLoading} className='space-y-3'>
|
||||||
<div className='simple_form__overlay-area'>
|
|
||||||
<div className='fields-group'>
|
|
||||||
{usernameUnavailable && (
|
{usernameUnavailable && (
|
||||||
<div className='error'>
|
<div className='error'>
|
||||||
<FormattedMessage id='registration.username_unavailable' defaultMessage='Username is already taken.' />
|
<FormattedMessage id='registration.username_unavailable' defaultMessage='Username is already taken.' />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<FormGroup hintText={intl.formatMessage(messages.username_hint)}>
|
<FormGroup hintText={intl.formatMessage(messages.username_hint)}>
|
||||||
<Input
|
<Input
|
||||||
type='text'
|
type='text'
|
||||||
|
@ -250,6 +249,7 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
type='email'
|
type='email'
|
||||||
name='email'
|
name='email'
|
||||||
|
@ -261,11 +261,13 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
|
||||||
value={params.get('email', '')}
|
value={params.get('email', '')}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{passwordMismatch && (
|
{passwordMismatch && (
|
||||||
<div className='error'>
|
<div className='error'>
|
||||||
<FormattedMessage id='registration.password_mismatch' defaultMessage="Passwords don't match." />
|
<FormattedMessage id='registration.password_mismatch' defaultMessage="Passwords don't match." />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
type='password'
|
type='password'
|
||||||
name='password'
|
name='password'
|
||||||
|
@ -278,6 +280,7 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
|
||||||
hasError={passwordMismatch === true}
|
hasError={passwordMismatch === true}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
type='password'
|
type='password'
|
||||||
name='password_confirmation'
|
name='password_confirmation'
|
||||||
|
@ -291,12 +294,15 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
|
||||||
hasError={passwordMismatch === true}
|
hasError={passwordMismatch === true}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
{birthdayRequired &&
|
|
||||||
|
{birthdayRequired && (
|
||||||
<BirthdayInput
|
<BirthdayInput
|
||||||
value={birthday}
|
value={birthday}
|
||||||
onChange={onBirthdayChange}
|
onChange={onBirthdayChange}
|
||||||
required
|
required
|
||||||
/>}
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{needsApproval && (
|
{needsApproval && (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
labelText={<FormattedMessage id='registration.reason' defaultMessage='Why do you want to join?' />}
|
labelText={<FormattedMessage id='registration.reason' defaultMessage='Why do you want to join?' />}
|
||||||
|
@ -311,7 +317,7 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
</div>
|
|
||||||
<CaptchaField
|
<CaptchaField
|
||||||
onFetch={onFetchCaptcha}
|
onFetch={onFetchCaptcha}
|
||||||
onFetchFail={onFetchCaptchaFail}
|
onFetchFail={onFetchCaptchaFail}
|
||||||
|
@ -321,7 +327,8 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
|
||||||
name='captcha_solution'
|
name='captcha_solution'
|
||||||
value={params.get('captcha_solution', '')}
|
value={params.get('captcha_solution', '')}
|
||||||
/>
|
/>
|
||||||
<div className='fields-group'>
|
|
||||||
|
<div className='simple_form space-y-3'>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label={intl.formatMessage(messages.agreement, { tos: <Link to='/about/tos' target='_blank' key={0}>{intl.formatMessage(messages.tos)}</Link> })}
|
label={intl.formatMessage(messages.agreement, { tos: <Link to='/about/tos' target='_blank' key={0}>{intl.formatMessage(messages.tos)}</Link> })}
|
||||||
name='agreement'
|
name='agreement'
|
||||||
|
@ -329,19 +336,22 @@ const RegistrationForm: React.FC<IRegistrationForm> = ({ inviteToken }) => {
|
||||||
checked={params.get('agreement', false)}
|
checked={params.get('agreement', false)}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
{supportsEmailList && <Checkbox
|
|
||||||
|
{supportsEmailList && (
|
||||||
|
<Checkbox
|
||||||
label={intl.formatMessage(messages.newsletter)}
|
label={intl.formatMessage(messages.newsletter)}
|
||||||
name='accepts_email_list'
|
name='accepts_email_list'
|
||||||
onChange={onCheckboxChange}
|
onChange={onCheckboxChange}
|
||||||
checked={params.get('accepts_email_list', false)}
|
checked={params.get('accepts_email_list', false)}
|
||||||
/>}
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className='actions'>
|
|
||||||
<button name='button' type='submit' className='btn button button-primary'>
|
<FormActions>
|
||||||
|
<Button>
|
||||||
<FormattedMessage id='registration.sign_up' defaultMessage='Sign up' />
|
<FormattedMessage id='registration.sign_up' defaultMessage='Sign up' />
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</FormActions>
|
||||||
</div>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|
Ładowanie…
Reference in New Issue