import { InputHTMLAttributes } from 'react';
import styled from 'styled-components';
import colors from 'styles/colors';
import { InputSize, applySize } from 'styles/dimensions';
type Orientation = 'horizontal' | 'vertical';
interface Props {
id: string,
value: string,
label?: string,
placeholder?: string,
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)};
`;
const Input = (inputProps: Props): JSX.Element => {
const { id, value, label, placeholder, size, orientation, handleChange } = inputProps;
return (
{ label && { label } }
);
};
export default Input;