Fix colors in ellipsis (#7632)

* Fix colors in ellipsis

* Change method name to align with convention

* Fix js lint
This commit is contained in:
Beto Dealmeida 2019-06-03 15:40:36 -07:00 committed by GitHub
parent 6d1f6e9df9
commit ddd7f8fb17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 23 deletions

View File

@ -60,7 +60,7 @@ export default class FilterableTable extends PureComponent {
constructor(props) {
super(props);
this.list = List(this.formatTableData(props.data));
this.headerRenderer = this.headerRenderer.bind(this);
this.renderHeader = this.renderHeader.bind(this);
this.rowClassName = this.rowClassName.bind(this);
this.sort = this.sort.bind(this);
@ -139,27 +139,6 @@ export default class FilterableTable extends PureComponent {
return values.some(v => v.includes(lowerCaseText));
}
headerRenderer({ dataKey, label, sortBy, sortDirection }) {
return (
<TooltipWrapper label="header" tooltip={label}>
<div className="header-style">
<span
className={
this.props.expandedColumns.indexOf(label) > -1
? 'header-style-disabled'
: ''
}
>
{label}
</span>
{sortBy === dataKey &&
<SortIndicator sortDirection={sortDirection} />
}
</div>
</TooltipWrapper>
);
}
rowClassName({ index }) {
let className = '';
if (this.props.striped) {
@ -172,6 +151,22 @@ export default class FilterableTable extends PureComponent {
this.setState({ sortBy, sortDirection });
}
renderHeader({ dataKey, label, sortBy, sortDirection }) {
const className = this.props.expandedColumns.indexOf(label) > -1
? 'header-style-disabled'
: 'header-style';
return (
<TooltipWrapper label="header" tooltip={label}>
<div className={className}>
{label}
{sortBy === dataKey &&
<SortIndicator sortDirection={sortDirection} />
}
</div>
</TooltipWrapper>
);
}
render() {
const { sortBy, sortDirection } = this.state;
const {
@ -229,7 +224,7 @@ export default class FilterableTable extends PureComponent {
<Column
dataKey={columnKey}
disableSort={false}
headerRenderer={this.headerRenderer}
headerRenderer={this.renderHeader}
width={this.widthsForColumnsByKey[columnKey]}
label={columnKey}
key={columnKey}

View File

@ -78,5 +78,8 @@
white-space: nowrap;
}
.header-style-disabled {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #aaa;
}