Add Input component

[MAILPOET-2772]
This commit is contained in:
Ján Mikláš
2020-05-06 17:29:54 +02:00
committed by Veljko V
parent 89e7618705
commit c7088e0fe7

View File

@@ -0,0 +1,36 @@
import React from 'react';
import classnames from 'classnames';
type Props = {
size?: 'small',
isFullWidth?: boolean,
iconStart?: JSX.Element,
iconEnd?: JSX.Element,
[attribute: string]: any, // any HTML attributes, e.g. type, name, id, placeholder
};
const Input = ({
size,
isFullWidth,
iconStart,
iconEnd,
...attributes
}: Props) => (
<div
className={
classnames(
'mailpoet-form-input',
{
[`mailpoet-form-input-${size}`]: size,
'mailpoet-full-width': isFullWidth,
}
)
}
>
{iconStart}
<input {...attributes} />
{iconEnd}
</div>
);
export default Input;