Skip to content

Commit

Permalink
clean up #805
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinVandy committed Dec 5, 2023
1 parent 62ef9ba commit 1d207cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@ export const MRT_TableHeadCellSortLabel = <TData extends MRT_RowData>({
isLoading || showSkeletons
? ''
: column.getIsSorted()
? column.getIsSorted() === 'desc'
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
: column.getNextSortingOrder() === 'desc'
? localization.sortByColumnDesc.replace('{column}', columnDef.header)
: localization.sortByColumnAsc.replace('{column}', columnDef.header);
? column.getIsSorted() === 'desc'
? localization.sortedByColumnDesc.replace(
'{column}',
columnDef.header,
)
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
: column.getNextSortingOrder() === 'desc'
? localization.sortByColumnDesc.replace('{column}', columnDef.header)
: localization.sortByColumnAsc.replace('{column}', columnDef.header);

const direction = isSorted
? (column.getIsSorted() as 'asc' | 'desc')
: undefined;

return (
<Tooltip placement="top" title={sortTooltip}>
Expand All @@ -56,7 +63,7 @@ export const MRT_TableHeadCellSortLabel = <TData extends MRT_RowData>({
? (props) => (
<SyncAltIcon
{...props}
direction={isSorted ? (column.getIsSorted() as 'asc' | 'desc') : undefined}
direction={direction}
style={{
transform: 'rotate(-90deg) scaleX(0.9) translateX(-1px)',
}}
Expand All @@ -66,9 +73,7 @@ export const MRT_TableHeadCellSortLabel = <TData extends MRT_RowData>({
}
active
aria-label={sortTooltip}
direction={
isSorted ? (column.getIsSorted() as 'asc' | 'desc') : undefined
}
direction={direction}
onClick={(e) => {
e.stopPropagation();
header.column.getToggleSortingHandler()?.(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const initData = [...Array(25)].map(() => ({
age: faker.number.int(20) + 18,
email: faker.internet.email(),
firstName: faker.person.firstName(),
id: faker.random.alphaNumeric(6),
id: faker.string.alphanumeric(6),
lastName: faker.person.lastName(),
state: faker.location.state(),
}));
Expand Down

1 comment on commit 1d207cb

@vercel
Copy link

@vercel vercel bot commented on 1d207cb Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.