Skip to content

Commit

Permalink
Fix colors in ellipsis (#7632)
Browse files Browse the repository at this point in the history
* Fix colors in ellipsis

* Change method name to align with convention

* Fix js lint
  • Loading branch information
betodealmeida authored Jun 3, 2019
1 parent 6d1f6e9 commit ddd7f8f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
41 changes: 18 additions & 23 deletions superset/assets/src/components/FilterableTable/FilterableTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,8 @@
white-space: nowrap;
}
.header-style-disabled {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #aaa;
}

0 comments on commit ddd7f8f

Please sign in to comment.