2019-08-14 16:54:31 -04:00
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import { DataTitleCopyable } from './data-title';
|
|
|
|
|
|
|
|
const DataEntry: React.FunctionComponent<any> = (props) => { // TODO: remove any
|
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
<DataTitleCopyable
|
|
|
|
slug={props.slug}
|
|
|
|
title={props.title}
|
|
|
|
tooltip={props.tooltip}
|
|
|
|
disabled={props.disabled}
|
|
|
|
copy={props.copy}
|
|
|
|
/>
|
2019-08-23 12:35:17 -04:00
|
|
|
<input className="form-control" type="text"
|
|
|
|
id={props.slug}
|
|
|
|
name={props.slug}
|
|
|
|
value={props.value || ''}
|
|
|
|
maxLength={props.maxLength}
|
|
|
|
disabled={props.mode === 'view' || props.disabled}
|
|
|
|
placeholder={props.placeholder}
|
|
|
|
onChange={props.onChange}
|
|
|
|
/>
|
2019-08-14 16:54:31 -04:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
DataEntry.propTypes = {
|
|
|
|
title: PropTypes.string,
|
|
|
|
slug: PropTypes.string,
|
|
|
|
tooltip: PropTypes.string,
|
|
|
|
disabled: PropTypes.bool,
|
|
|
|
value: PropTypes.any,
|
2019-08-23 12:35:17 -04:00
|
|
|
placeholder: PropTypes.string,
|
|
|
|
maxLength: PropTypes.number,
|
|
|
|
onChange: PropTypes.func,
|
2019-08-14 16:54:31 -04:00
|
|
|
copy: PropTypes.shape({
|
|
|
|
copying: PropTypes.bool,
|
|
|
|
copyingKey: PropTypes.func,
|
|
|
|
toggleCopyAttribute: PropTypes.func
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export default DataEntry;
|