File size: 793 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 clsx from 'clsx';
import PropTypes from 'prop-types';
import { Component } from 'react';
import FormTextInput from 'calypso/components/forms/form-text-input';

import './style.scss';

export default class extends Component {
	static displayName = 'FormTextInputWithAffixes';

	static propTypes = {
		noWrap: PropTypes.bool,
		prefix: PropTypes.node,
		suffix: PropTypes.node,
	};

	render() {
		const { noWrap, prefix, suffix, ...rest } = this.props;

		return (
			<div className={ clsx( 'form-text-input-with-affixes', { 'no-wrap': noWrap } ) }>
				{ prefix && <span className="form-text-input-with-affixes__prefix">{ prefix }</span> }

				<FormTextInput { ...rest } />

				{ suffix && <span className="form-text-input-with-affixes__suffix">{ suffix }</span> }
			</div>
		);
	}
}