import { type InputHTMLAttributes } from 'react'; import styled from '@emotion/styled'; import colors from 'v1-check/styles/colors'; import { type InputSize, applySize } from 'v1-check/styles/dimensions'; type Orientation = 'horizontal' | 'vertical'; interface Props { id: string, value: string, label?: string, placeholder?: string, disabled?: boolean, size?: InputSize, orientation?: Orientation; handleChange: (nweVal: React.ChangeEvent) => void, }; type SupportedElements = HTMLInputElement | HTMLLabelElement | HTMLDivElement; interface StyledInputTypes extends InputHTMLAttributes { inputSize?: InputSize; orientation?: Orientation; }; const InputContainer = styled.div` display: flex; ${props => props.orientation === 'vertical' ? 'flex-direction: column;' : ''}; `; const StyledInput = styled.input` background: ${colors.background}; color: ${colors.textColor}; border: none; border-radius: 0.25rem; font-family: PTMono; box-shadow: 3px 3px 0px ${colors.backgroundDarker}; &:focus { outline: 1px solid ${colors.primary} } ${props => applySize(props.inputSize)}; `; const StyledLabel = styled.label` color: ${colors.textColor}; ${props => applySize(props.inputSize)}; padding: 0; font-size: 1.6rem; `; const Input = (inputProps: Props): JSX.Element => { const { id, value, label, placeholder, disabled, size, orientation, handleChange } = inputProps; return ( { label && { label } } ); }; export default Input;