This commit is contained in:
Eduard Heimbuch
2019-12-03 09:42:12 +01:00
parent 5e3e57eb48
commit 5e907ea0b5

View File

@@ -65,6 +65,10 @@ const Table: FC<Props> = ({ data, sortable, children }) => {
setlastSortBy(index);
};
const shouldShowIcon = (index: number) => {
return index === lastSortBy || index === hoveredColumnIndex;
};
return (
tableData.length > 0 && (
<StyledTable>
@@ -81,8 +85,7 @@ const Table: FC<Props> = ({ data, sortable, children }) => {
// @ts-ignore
child.props.header
}
{isSortable(child) &&
renderSortIcon(child, ascending, index === lastSortBy || index === hoveredColumnIndex)}
{isSortable(child) && renderSortIcon(child, ascending, shouldShowIcon(index))}
</th>
))}
</tr>