Captcha: improve styles

homepage-hide-logo
Alex Gleason 2022-05-06 18:05:34 -05:00
rodzic aa4faeb96c
commit 047c50cc02
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 30 dodań i 18 usunięć

Wyświetl plik

@ -1,13 +1,17 @@
import { Map as ImmutableMap } from 'immutable'; import { Map as ImmutableMap } from 'immutable';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { FormattedMessage } from 'react-intl'; import { useIntl, defineMessages, FormattedMessage } from 'react-intl';
import { fetchCaptcha } from 'soapbox/actions/auth'; import { fetchCaptcha } from 'soapbox/actions/auth';
import { TextInput } from 'soapbox/features/forms'; import { Text, Input } from 'soapbox/components/ui';
import { useAppDispatch } from 'soapbox/hooks'; import { useAppDispatch } from 'soapbox/hooks';
const noOp = () => {}; const noOp = () => {};
const messages = defineMessages({
placeholder: { id: 'registration.captcha.placeholder', defaultMessage: 'Enter the pictured text' },
});
interface ICaptchaField { interface ICaptchaField {
name?: string, name?: string,
value: string, value: string,
@ -71,7 +75,9 @@ const CaptchaField: React.FC<ICaptchaField> = ({
case 'native': case 'native':
return ( return (
<div> <div>
<p>{<FormattedMessage id='registration.captcha.hint' defaultMessage='Click the image to get a new captcha' />}</p> <Text>
<FormattedMessage id='registration.captcha.hint' defaultMessage='Click the image to get a new captcha' />
</Text>
<NativeCaptchaField <NativeCaptchaField
captcha={captcha} captcha={captcha}
@ -96,21 +102,27 @@ interface INativeCaptchaField {
value: string, value: string,
} }
const NativeCaptchaField: React.FC<INativeCaptchaField> = ({ captcha, onChange, onClick, name, value }) => ( const NativeCaptchaField: React.FC<INativeCaptchaField> = ({ captcha, onChange, onClick, name, value }) => {
<div className='captcha' > const intl = useIntl();
<img alt='captcha' src={captcha.get('url')} onClick={onClick} />
<TextInput return (
placeholder='Enter the pictured text' <div className='captcha' >
name={name} <img alt='captcha' src={captcha.get('url')} onClick={onClick} />
value={value}
autoComplete='off' <Input
autoCorrect='off' type='text'
autoCapitalize='off' placeholder={intl.formatMessage(messages.placeholder)}
onChange={onChange} name={name}
required value={value}
/> autoComplete='off'
</div> autoCorrect='off'
); autoCapitalize='off'
onChange={onChange}
required
/>
</div>
);
};
export { export {
CaptchaField as default, CaptchaField as default,