Skip to content

Commit 45d063a

Browse files
authored
init commit - update table2beta. (#852)
1 parent f5b65b1 commit 45d063a

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "clever-components",
3-
"version": "2.224.0",
3+
"version": "2.225.0",
44
"description": "A library of helpful React components and less styles",
55
"repository": {
66
"type": "git",

src/Table2Beta/Column.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface Props {
1212
};
1313
noWrap?: boolean;
1414
sortable?: boolean;
15+
tooltip?: React.ReactNode;
1516
sortValueFn?: Function;
1617
width?: string; // Not included in propTypes but appears to work and is commonly used.
1718
}
@@ -32,6 +33,7 @@ Column.propTypes = {
3233
}),
3334
noWrap: PropTypes.bool,
3435
sortable: PropTypes.bool,
36+
tooltip: PropTypes.node,
3537
sortValueFn: PropTypes.func,
3638
};
3739

src/Table2Beta/Header.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export default function Header({
4141
key={column.id}
4242
onSortChange={() => onSortChange(column.id)}
4343
sortable={column.sortable && !disableSort}
44+
tooltip={column.tooltip ? column.tooltip : null}
4445
width={column.width}
4546
>
4647
{column.header && column.header.content}

src/Table2Beta/HeaderCell.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@
3636
fill: @neutral_black;
3737
}
3838
}
39+
40+
.Table--header--cell--tooltip {
41+
margin-left: 0.625rem;
42+
cursor: pointer;
43+
}

src/Table2Beta/HeaderCell.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface Props {
1414
children?: React.ReactNode;
1515
onSortChange?: Function;
1616
sortable?: boolean;
17+
tooltip?: React.ReactNode;
1718
activeSortDirection?: "asc" | "desc";
1819
width?: string;
1920
}
@@ -24,13 +25,15 @@ export const cssClass = {
2425
LABEL: "Table--header--cell--label",
2526
SORTABLE: "Table--header--cell--sortable",
2627
SORT: "Table--header--cell--sort_icons",
28+
TOOLTIP: "Table--header--cell--tooltip",
2729
};
2830

2931
export default function HeaderCell({
3032
children,
3133
className,
3234
onSortChange,
3335
sortable,
36+
tooltip,
3437
activeSortDirection,
3538
width,
3639
}: Props) {
@@ -59,6 +62,7 @@ export default function HeaderCell({
5962
<SortIcons direction={activeSortDirection} className={cssClass.SORT} />
6063
</div>
6164
)}
65+
{tooltip && <div className={cssClass.TOOLTIP}>{tooltip}</div>}
6266
</FlexBox>
6367
</Cell>
6468
);

0 commit comments

Comments
 (0)