Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Make the columns sort function more visible. (#4526)

Marcus Farrelld7f452e81030
diff --git a/packages/ui/src/icons/sort-order.tsx b/packages/ui/src/icons/sort-order.tsx
index 4654f722b7..1735cfd470 100644
--- a/packages/ui/src/icons/sort-order.tsx
+++ b/packages/ui/src/icons/sort-order.tsx
@@ -19,7 +19,6 @@ export function SortOrder({
xmlns="http://www.w3.org/2000/svg"
>
<motion.path
- className={cn(!order && "opacity-40")}
animate={{ d: order === "asc" ? downPath : upPath }}
stroke="currentColor"
strokeWidth="1.5"
@@ -27,7 +26,7 @@ export function SortOrder({
strokeLinejoin="round"
/>
<motion.path
- className="opacity-40"
+ className={cn(order && "opacity-40")}
animate={{ d: order === "asc" ? upPath : downPath }}
stroke="currentColor"
strokeWidth="1.5"
diff --git a/packages/ui/src/table/table.tsx b/packages/ui/src/table/table.tsx
index 413f2579fe..ce18d38c90 100644
--- a/packages/ui/src/table/table.tsx
+++ b/packages/ui/src/table/table.tsx
@@ -580,6 +580,7 @@ export function Table<T>({
header.column.id === "select"
? "flex size-full items-center justify-center"
: "flex items-center gap-2",
+ isSortableColumn && "group/sort",
)}
{...(isSortableColumn && {
type: "button",
@@ -616,13 +617,21 @@ export function Table<T>({
</HeaderWithTooltip>
);
})()}
- {isSortableColumn &&
- sortBy === header.column.id && (
- <SortOrder
- className="h-3 w-3 shrink-0"
- order={sortOrder || "desc"}
- />
- )}
+ {isSortableColumn && (
+ <SortOrder
+ className={cn(
+ "h-3 w-3 shrink-0",
+ sortBy === header.column.id
+ ? "text-neutral-950"
+ : "text-neutral-300 group-hover/sort:text-neutral-400",
+ )}
+ order={
+ sortBy === header.column.id
+ ? sortOrder || "desc"
+ : null
+ }
+ />
+ )}
</ButtonOrDiv>
</div>
{enableColumnResizing &&