Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
fix(Table): Add key to table children.
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCoplan committed Oct 1, 2018
1 parent 5e639e8 commit 600ad1b
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/components/Table/Table.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import TableRow from "./TableRow.react";
import TableCol from "./TableCol.react";
import TableColHeader from "./TableColHeader.react";

type BodyItem = {|
key: string | number,
item: Array<{
+content?: React.Node,
+className?: string,
+alignContent?: "left" | "center" | "right",
}>
|};

type Props = {|
+children?: React.Node,
+className?: string,
Expand All @@ -27,13 +36,7 @@ type Props = {|
+hasOutline?: boolean,
+verticalAlign?: "center",
+headerItems?: Array<{ +content?: React.Node, +className?: string }>,
+bodyItems?: Array<
Array<{
+content?: React.Node,
+className?: string,
+alignContent?: "left" | "center" | "right",
}>
>,
+bodyItems?: Array<BodyItem>,
|};

function Table({
Expand Down Expand Up @@ -74,11 +77,12 @@ function Table({
const body = props.bodyItems && (
<Table.Body>
{props.bodyItems.map((row, i) => (
<Table.Row>
{row.map(col => (
<Table.Row key={row.key}>
{row.item.map((col, i) => (
<Table.Col
className={col.className}
alignContent={col.alignContent}
key={i}
>
{col.content}
</Table.Col>
Expand Down

0 comments on commit 600ad1b

Please sign in to comment.