import React from 'react'; import PropTypes from 'prop-types'; import Tooltip from '../../components/tooltip'; interface DataTitleProps { title: string; tooltip: string; } const DataTitle: React.FunctionComponent = (props) => { return (
{ props.title } { props.tooltip? : null }
) } DataTitle.propTypes = { title: PropTypes.string, tooltip: PropTypes.string } interface DataTitleCopyableProps { title: string; tooltip: string; slug: string; disabled?: boolean; copy?: any; // TODO: type should be CopyProps, but that clashes with propTypes in some obscure way } const DataTitleCopyable: React.FunctionComponent = (props) => { return (
{ props.tooltip? : null } { (props.copy && props.copy.copying && props.slug && !props.disabled)?
: null }
); } DataTitleCopyable.propTypes = { title: PropTypes.string, tooltip: PropTypes.string, slug: PropTypes.string, disabled: PropTypes.bool, copy: PropTypes.shape({ copying: PropTypes.bool, copyingKey: PropTypes.func, toggleCopyAttribute: PropTypes.func, toggleCopying: PropTypes.func }) } export default DataTitle; export { DataTitleCopyable }