import * as React from 'react'; import styled from 'styled-components'; import { TextInputProps, InputProps } from './interface'; import { StyledError } from '.'; import InputLabel from '../Typography/Label'; import * as tokens from '@tokens'; import { dim } from '../../utils/dim'; const StyledInput = styled.input` ${tokens.fontBody}; border: 1px solid ${(p: InputProps) => (p.error ? tokens.colorPink : tokens.colorBlack)}; color: ${(p: InputProps) => (p.error ? tokens.colorPink : tokens.colorBlack)}; border-radius: 0; width: 100%; height: 40px; font-family: ${tokens.fontBody}; padding: ${dim(1.5)} ${dim(2)}; appearance: none; outline: 0; background-image: none; background-color: ${tokens.colorWhite}; box-shadow: none; box-sizing: border-box; &:disabled { cursor: not-allowed; color: ${tokens.colorGrey15}; } &::placeholder { color: ${tokens.colorGrey40}; } `; const LabelText = styled(InputLabel)` margin: 0 0 ${dim(2)}; `; const Label = styled.label` display: block; & + & { margin-top: 30px; } `; export const Input: React.FC = ({ label = '', placeholder = '', error, type = 'text', pattern = '', autocomplete = true, onChange = () => {}, ...props }: TextInputProps) => ( );