Skip to content

Commit 35c3f70

Browse files
committed
feat: show tippy on sortable table header if truncated through prop
1 parent a278e3f commit 35c3f70

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { Tippy } from '..'
1718
import { ReactComponent as SortIcon } from '../../Assets/Icon/ic-arrow-up-down.svg'
1819
import { ReactComponent as SortArrowDown } from '../../Assets/Icon/ic-sort-arrow-down.svg'
1920
import { SortingOrder } from '../Constants'
@@ -41,6 +42,7 @@ const SortableTableHeaderCell = ({
4142
title,
4243
disabled,
4344
isSortable = true,
45+
showTippyOnTruncate = false,
4446
}: SortableTableHeaderCellProps) => {
4547
const renderSortIcon = () => {
4648
if (!isSortable) {
@@ -65,7 +67,15 @@ const SortableTableHeaderCell = ({
6567
onClick={isSortable ? triggerSorting : noop}
6668
disabled={disabled}
6769
>
68-
<span className="dc__uppercase dc__ellipsis-right">{title}</span>
70+
<Tippy
71+
showOnTruncate={showTippyOnTruncate}
72+
className="default-tt"
73+
placement="top"
74+
arrow={false}
75+
content={title}
76+
>
77+
<span className="dc__uppercase dc__ellipsis-right">{title}</span>
78+
</Tippy>
6979
{renderSortIcon()}
7080
</button>
7181
)

src/Common/SortableTableHeaderCell/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ export interface SortableTableHeaderCellProps {
4444
* @default true
4545
*/
4646
isSortable?: boolean
47+
showTippyOnTruncate?: boolean
4748
}

0 commit comments

Comments
 (0)