Skip to content

Commit

Permalink
feat(table): add column component
Browse files Browse the repository at this point in the history
This introduces the Column component to the library. The Column will take 3 properties:
  - cellRenderer
    The cellRenderer will expect a function which returns a JSX.Element which will be
    used to render the Datum cell.
  - width
    The width will expect a function to calculate the width it should return a number.
    As a parameter the total count of columns, total width, remaining width and current
    column index are provided in a single object.
  - label
    The label expects a JSX Element or a string which will be used to render the header.

closes DCOS-38064
  • Loading branch information
Poltergeist committed Jul 3, 2018
1 parent 069d652 commit 6550051
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { Badge } from "./badge";
export { BadgeButton } from "./badge";
export { Column } from "./table";
3 changes: 3 additions & 0 deletions packages/table/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Table Name

Table documentation
16 changes: 16 additions & 0 deletions packages/table/components/Column.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as React from "react";
interface IWidthArgs {
width: number;
totalColumns: number;
remainingWidth: number;
currentIndex: number;
}
export interface IColumnProps {
header: string | React.ReactNode;
cellRenderer: (data: any) => React.ReactNode;
width: (args: IWidthArgs) => number;
}

export class Column extends React.PureComponent<IColumnProps, {}> {}

export default Column;
1 change: 1 addition & 0 deletions packages/table/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Column } from "./components/Column";

0 comments on commit 6550051

Please sign in to comment.