66import React , { Component } from 'react' ;
77import PropTypes from 'prop-types' ;
88import classnames from 'classnames' ;
9- import Tooltip from '../../tooltip' ;
109
1110const displayName = 'PageHeaderDetailRow' ;
1211const propTypes = {
@@ -43,21 +42,6 @@ const defaultProps = {
4342} ;
4443
4544class DetailBlock extends Component {
46- constructor ( props ) {
47- super ( props ) ;
48- this . state = { showTooltip : false } ;
49- }
50-
51- componentDidMount ( ) {
52- this . renderFieldTruncation ( ) ;
53- }
54-
55- componentDidUpdate ( prevProps ) {
56- if ( this . props . content !== prevProps . content ) {
57- this . renderFieldTruncation ( ) ;
58- }
59- }
60-
6145 renderContent ( ) {
6246 const { content, truncate } = this . props ;
6347
@@ -80,35 +64,6 @@ class DetailBlock extends Component {
8064 return content ;
8165 }
8266
83- renderContentWithTooltip ( ) {
84- const { content, truncate } = this . props ;
85- const labelClasses = classnames ( { 'slds-truncate' : truncate } ) ;
86-
87- return (
88- < Tooltip
89- align = "top"
90- content = { content }
91- triggerStyle = { { display : 'inline' } }
92- >
93- < div className = { labelClasses } tabIndex = "0" title = { content } >
94- { content }
95- </ div >
96- </ Tooltip >
97- ) ;
98- }
99-
100- renderFieldTruncation ( ) {
101- const fieldContent = this . fieldContentRef ;
102- const isTruncated =
103- fieldContent && fieldContent . scrollWidth > fieldContent . offsetWidth ;
104-
105- if ( isTruncated ) {
106- this . setState ( { showTooltip : true } ) ;
107- } else {
108- this . setState ( { showTooltip : false } ) ;
109- }
110- }
111-
11267 renderLabel ( ) {
11368 const { label, truncate } = this . props ;
11469
@@ -137,9 +92,7 @@ class DetailBlock extends Component {
13792 return (
13893 < li className = { classes } >
13994 { this . renderLabel ( ) }
140- { this . state . showTooltip
141- ? this . renderContentWithTooltip ( )
142- : this . renderContent ( ) }
95+ { this . renderContent ( ) }
14396 </ li >
14497 ) ;
14598 }
0 commit comments