fix(1451): card form autocomplete (#447)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 4 years ago committed by GitHub
parent 35716023b3
commit b0ba9524a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/features/AddCardForm/components/ElementContainer/index.tsx
  2. 16
      src/features/AddCardForm/components/Form/index.tsx
  3. 2
      src/features/AddCardForm/index.tsx
  4. 2
      src/features/AddCardForm/styled.tsx

@ -47,6 +47,10 @@ const Label = styled.label<LabelProps>`
} }
` `
: ''}; : ''};
.StripeElement--webkit-autofill {
background-color: transparent !important;
}
` `
const Text = styled(T9n)` const Text = styled(T9n)`

@ -24,19 +24,27 @@ import {
SectionTitle, SectionTitle,
} from '../../styled' } from '../../styled'
const autoFillStyles = {
':-webkit-autofill': {
color: '#fff',
},
}
const baseStyles = isMobileDevice const baseStyles = isMobileDevice
? { ? {
color: '#fff', color: '#fff',
fontSize: '12px', fontSize: '12px',
fontWeight: 'bold', fontWeight: 'bold',
lineHeight: '12px', lineHeight: '12px',
...autoFillStyles,
} }
: { : {
color: '#fff', color: '#fff',
fontFamily: 'Montserrat, Tahoma, sans-serif', fontFamily: 'Montserrat, Tahoma, sans-serif',
fontSize: '20px', fontSize: '20px',
fontWeight: 'bold', fontWeight: 'bold',
lineHeight: '50px', lineHeight: '48px',
...autoFillStyles,
} }
const options = { placeholder: '', style: { base: baseStyles } } const options = { placeholder: '', style: { base: baseStyles } }
@ -81,12 +89,18 @@ export const AddCardFormInner = (props: Props) => {
label={isLabelVisible(ElementTypes.CardHolder) ? 'card_holder_name' : ''} label={isLabelVisible(ElementTypes.CardHolder) ? 'card_holder_name' : ''}
backgroundColor={inputsBackground} backgroundColor={inputsBackground}
> >
{/* не удаляем, без Form автозаполнение не работает */}
<Form>
<Input <Input
type='text'
name='ccname'
autoComplete='cc-name'
value={name} value={name}
onChange={onNameChange} onChange={onNameChange}
onFocus={onInputsFocus(ElementTypes.CardHolder)} onFocus={onInputsFocus(ElementTypes.CardHolder)}
onBlur={onInputsBlur(ElementTypes.CardHolder)} onBlur={onInputsBlur(ElementTypes.CardHolder)}
/> />
</Form>
</ElementContainer> </ElementContainer>
<ElementContainer <ElementContainer

@ -14,7 +14,6 @@ import { AddCardFormInner } from './components/Form'
export const AddCardForm = ({ export const AddCardForm = ({
initialformOpen, initialformOpen,
inputsBackground,
onAddSuccess, onAddSuccess,
}: Props) => { }: Props) => {
const { isOpen, toggle } = useToggle(initialformOpen) const { isOpen, toggle } = useToggle(initialformOpen)
@ -33,7 +32,6 @@ export const AddCardForm = ({
isOpen isOpen
? ( ? (
<AddCardFormInner <AddCardFormInner
inputsBackground={inputsBackground}
onAddSuccess={onSuccess} onAddSuccess={onSuccess}
> >
<SolidButton type='submit'> <SolidButton type='submit'>

@ -34,7 +34,7 @@ export const Input = styled.input`
:-webkit-autofill:hover, :-webkit-autofill:hover,
:-webkit-autofill:focus, :-webkit-autofill:focus,
:-webkit-autofill:active { :-webkit-autofill:active {
box-shadow: 0 0 0 30px #535353 inset; box-shadow: 0 0 0 30px #3f3f3f inset;
caret-color: ${({ theme: { colors } }) => colors.text100}; caret-color: ${({ theme: { colors } }) => colors.text100};
-webkit-text-fill-color: ${({ theme: { colors } }) => colors.text100}; -webkit-text-fill-color: ${({ theme: { colors } }) => colors.text100};
} }

Loading…
Cancel
Save