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,11 +102,16 @@ 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 }) => {
const intl = useIntl();
return (
<div className='captcha' > <div className='captcha' >
<img alt='captcha' src={captcha.get('url')} onClick={onClick} /> <img alt='captcha' src={captcha.get('url')} onClick={onClick} />
<TextInput
placeholder='Enter the pictured text' <Input
type='text'
placeholder={intl.formatMessage(messages.placeholder)}
name={name} name={name}
value={value} value={value}
autoComplete='off' autoComplete='off'
@ -110,7 +121,8 @@ const NativeCaptchaField: React.FC<INativeCaptchaField> = ({ captcha, onChange,
required required
/> />
</div> </div>
); );
};
export { export {
CaptchaField as default, CaptchaField as default,