-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
table-head.tsx
33 lines (27 loc) · 918 Bytes
/
table-head.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import "./table-head.scss";
import React from "react";
import { cssNames } from "../../utils";
export type TableHeadElem = React.ReactElement<TableHeadProps>;
export interface TableHeadProps extends React.DOMAttributes<HTMLDivElement> {
className?: string;
showTopLine?: boolean; // show border line at the top
sticky?: boolean; // keep header on top when scrolling
nowrap?: boolean; // white-space: nowrap, align inner <TableCell> in one line
}
export class TableHead extends React.Component<TableHeadProps> {
static defaultProps: TableHeadProps = {
sticky: true,
};
render() {
const { className, sticky, nowrap, showTopLine, children, ...headProps } = this.props;
const classNames = cssNames("TableHead", className, {
sticky, nowrap,
topLine: showTopLine,
});
return (
<div className={classNames} {...headProps}>
{children}
</div>
);
}
}