From 174a5f20b9a005a00e4cd3985589244b0823b5c2 Mon Sep 17 00:00:00 2001 From: Andrey Morozov Date: Fri, 19 Jan 2024 12:52:24 +0300 Subject: [PATCH] feat: use different icon for unsorted column --- .../SortIndicator/SortIndicator.tsx | 18 +++++++++++++++--- .../hoc/withTableSorting/withTableSorting.tsx | 4 +--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.tsx b/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.tsx index 8da3bc9942..10911b2a7e 100644 --- a/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.tsx +++ b/src/components/Table/hoc/withTableSorting/SortIndicator/SortIndicator.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import {ArrowDown, ArrowUp} from '@gravity-ui/icons'; +import {ArrowDown, ArrowUp, ArrowUpArrowDown} from '@gravity-ui/icons'; import {Icon} from '../../../../Icon'; import {block} from '../../../../utils/cn'; @@ -13,10 +13,22 @@ export interface SortIndicatorProps { const b = block('sort-indicator'); -export function SortIndicator({order = 'asc'}: SortIndicatorProps) { +export function SortIndicator({order}: SortIndicatorProps) { + let icon; + switch (order) { + case 'asc': + icon = ArrowUp; + break; + case 'desc': + icon = ArrowDown; + break; + default: + icon = ArrowUpArrowDown; + } + return (
- +
); } diff --git a/src/components/Table/hoc/withTableSorting/withTableSorting.tsx b/src/components/Table/hoc/withTableSorting/withTableSorting.tsx index 45ede3454a..986d2b5bfe 100644 --- a/src/components/Table/hoc/withTableSorting/withTableSorting.tsx +++ b/src/components/Table/hoc/withTableSorting/withTableSorting.tsx @@ -138,9 +138,7 @@ export function withTableSorting( ,
,
- +
, ];