Title hover for truncated text

This commit is contained in:
dannyrb 2020-05-11 21:36:51 -04:00 committed by James A. Petts
parent 8dac6d7318
commit 36bc73579d
2 changed files with 12 additions and 5 deletions

View File

@ -35,22 +35,20 @@ const StudyListTableRow = props => {
onClick={onClickRow} onClick={onClickRow}
> >
{row.map((cell, index) => { {row.map((cell, index) => {
const { content, gridCol, name } = cell; const { content, title, gridCol, name } = cell;
return ( return (
<td <td
key={name} key={name}
className={classnames( className={classnames(
'px-4 py-2 text-base', 'px-4 py-2 text-base truncate',
{ 'border-b border-secondary-light': !isExpanded }, { 'border-b border-secondary-light': !isExpanded },
`w-${gridCol}/24` || '' `w-${gridCol}/24` || ''
)} )}
style={{ style={{
maxWidth: 0, maxWidth: 0,
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
}} }}
title={title}
> >
{index === 0 && ( {index === 0 && (
<Icon <Icon
@ -83,6 +81,8 @@ StudyListTableRow.propTypes = {
PropTypes.shape({ PropTypes.shape({
key: PropTypes.string.isRequired, key: PropTypes.string.isRequired,
content: PropTypes.node.isRequired, content: PropTypes.node.isRequired,
/** Title attribute to use for provided content */
title: PropTypes.string,
gridCol: PropTypes.number.isRequired, gridCol: PropTypes.number.isRequired,
}) })
).isRequired, ).isRequired,

View File

@ -165,11 +165,13 @@ function StudyListContainer({ history, data: studies }) {
{ {
key: 'patientName', key: 'patientName',
content: patientName, content: patientName,
title: patientName,
gridCol: 4, gridCol: 4,
}, },
{ {
key: 'mrn', key: 'mrn',
content: patientId, content: patientId,
title: patientId,
gridCol: 2, gridCol: 2,
}, },
{ {
@ -182,21 +184,25 @@ function StudyListContainer({ history, data: studies }) {
<span>{moment(studyTime).format('hh:mm A')}</span> <span>{moment(studyTime).format('hh:mm A')}</span>
</div> </div>
), ),
title: 'time',
gridCol: 5, gridCol: 5,
}, },
{ {
key: 'description', key: 'description',
content: studyDescription, content: studyDescription,
title: studyDescription,
gridCol: 4, gridCol: 4,
}, },
{ {
key: 'modality', key: 'modality',
content: modalities, content: modalities,
title: modalities,
gridCol: 3, gridCol: 3,
}, },
{ {
key: 'accession', key: 'accession',
content: accessionNumber, content: accessionNumber,
title: accessionNumber,
gridCol: 4, gridCol: 4,
}, },
{ {
@ -213,6 +219,7 @@ function StudyListContainer({ history, data: studies }) {
{instances} {instances}
</> </>
), ),
title: instances,
gridCol: 4, gridCol: 4,
}, },
], ],