mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 14:05:44 +01:00
refactor
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user