1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-01 15:46:40 +07:00
vault-frontend/src/components/input/TextInput/index.tsx
2020-11-06 12:15:07 +07:00

37 lines
745 B
TypeScript

import * as React from 'react';
import styles from './styles.module.scss';
interface ITextInputProps {
type?: 'text' | 'password';
placeholder?: string;
label?: string;
value?: string;
onChange: React.ChangeEventHandler;
}
export const TextInput: React.FunctionComponent<ITextInputProps> = ({
type = 'text',
placeholder = '',
label,
onChange = () => {},
value = '',
}) => (
<div
className={styles.wrapper}
>
<div className={styles.container}>
{
label
&& <div className={styles.label}>{label}</div>
}
<input
placeholder={placeholder}
className={styles.input}
type={type}
onChange={onChange}
value={value}
/>
</div>
</div>
);