forked from regentmarkets-repo-archive/binary-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputGroup.js
More file actions
31 lines (27 loc) · 729 Bytes
/
Copy pathInputGroup.js
File metadata and controls
31 lines (27 loc) · 729 Bytes
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
import React, { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import Label from '../i18n/Label';
export default class InputGroup extends PureComponent {
props: {
id: string,
className: string,
label: string,
placeholder: string,
};
render() {
const { label, className, id, placeholder, ...rest } = this.props;
return (
<fieldset className={className}>
{label && <Label htmlFor={id} text={label} />}
{placeholder ?
<FormattedMessage id={placeholder} defaultMessage={placeholder}>
{(message: string) =>
<input id={id} placeholder={message} {...rest} />
}
</FormattedMessage> :
<input id={id} {...rest} />
}
</fieldset>
);
}
}