aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/ui/input.tsx
blob: 024e81b150469b15ff98961f3a8e00e0c3762e9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as React from 'react';

import { ColorOption, styled } from '../../style/theme';

export interface InputProps extends React.HTMLAttributes<HTMLInputElement> {
    tabIndex?: number;
    className?: string;
    value?: string;
    width?: string;
    fontSize?: string;
    fontColor?: ColorOption;
    placeholder?: string;
    type?: string;
    onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
}

export const Input = styled.input<InputProps>`
    && {
        all: initial;
        font-size: ${props => props.fontSize};
        width: ${props => props.width};
        padding: 0.1em 0em;
        font-family: 'Inter UI';
        color: ${props => props.theme[props.fontColor || 'white']};
        background: transparent;
        outline: none;
        border: none;
        &::placeholder {
            color: ${props => props.theme[props.fontColor || 'white']} !important;
            opacity: 0.5 !important;
        }
        &::-webkit-outer-spin-button,
        &::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
    }
`;

Input.defaultProps = {
    width: 'auto',
    fontColor: ColorOption.white,
    fontSize: '12px',
};

Input.displayName = 'Input';