Skip to content

Commit

Permalink
Changed default sort cycle in table headers
Browse files Browse the repository at this point in the history
  • Loading branch information
fgatti675 committed Apr 11, 2022
1 parent 795ca92 commit dff0da2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ export function Table<T>({

const isDesc = sortByProperty === key && currentSort === "desc";
const isAsc = sortByProperty === key && currentSort === "asc";
const newSort = isDesc ? "asc" : (isAsc ? undefined : "desc");
const newSortProperty: string | undefined = isAsc ? undefined : key;
const newSort = isAsc ? "desc" : (isDesc ? undefined : "asc");
const newSortProperty: string | undefined = isDesc ? undefined : key;

const newSortBy: [string, "asc" | "desc"] | undefined = newSort && newSortProperty ? [newSortProperty, newSort] : undefined;
if (filter) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/Table/TableHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function TableHeaderInternal<M extends { [Key: string]: any }>({
onColumnSort(column.key as Extract<keyof M, string>);
}}
>
{!sort && <ArrowDownwardIcon fontSize={"small"}/>}
{!sort && <ArrowUpwardIcon fontSize={"small"}/>}
{sort === "asc" &&
<ArrowUpwardIcon fontSize={"small"}/>}
{sort === "desc" &&
Expand Down

0 comments on commit dff0da2

Please sign in to comment.