Add Select component

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

View File

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