1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/dashboard/client/components/table/table-row.tsx
Jari Kolehmainen 1d0815abd2
Lens app source code (#119)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
2020-03-15 09:52:02 +02:00

30 lines
1.0 KiB
TypeScript

import "./table-row.scss";
import React, { CSSProperties } from "react";
import { cssNames } from "../../utils";
import { ItemObject } from "../../item.store";
export type TableRowElem = React.ReactElement<TableRowProps>;
export interface TableRowProps extends React.DOMAttributes<HTMLDivElement> {
className?: string;
selected?: boolean;
style?: CSSProperties;
nowrap?: boolean; // white-space: nowrap, align inner <TableCell> in one line
sortItem?: ItemObject | any; // data for sorting callback in <Table sortable={}/>
searchItem?: ItemObject | any; // data for searching filters in <Table searchable={}/>
disabled?: boolean;
}
export class TableRow extends React.Component<TableRowProps> {
render() {
const { className, nowrap, selected, disabled, children, sortItem, searchItem, ...rowProps } = this.props;
const classNames = cssNames("TableRow", className, { selected, nowrap, disabled });
return (
<div className={classNames} {...rowProps}>
{children}
</div>
)
}
}