update test data

This commit is contained in:
Eduard Heimbuch
2019-12-03 15:28:26 +01:00
parent 5502ad554b
commit a08d47df82
2 changed files with 69 additions and 31 deletions

View File

@@ -7,15 +7,15 @@ import { ColumnProps } from "./table";
storiesOf("Table|Table", module)
.add("Default", () => (
<Table data={[{ first: "dddd", second: "xyz" }, { first: "abc", second: "bbbb" }]}>
<Column header={"FIRST"}>{(row: any) => <h1>{row.first}</h1>}</Column>
<Table data={[{ firstname: "Tricia", lastname: "McMillan", email: "tricia@hitchhiker.com" }, { firstname: "Arthur", lastname: "Dent", email: "arthur@hitchhiker.com" }]}>
<Column header={"First Name"}>{(row: any) => <h4>{row.firstname}</h4>}</Column>
<Column
header={"SECOND"}
header={"Last Name"}
createComparator={(props: ColumnProps, columnIndex: number) => {
return (a: any, b: any) => {
if (a.second > b.second) {
if (a.lastname > b.lastname) {
return -1;
} else if (a.second < b.second) {
} else if (a.lastname < b.lastname) {
return 1;
} else {
return 0;
@@ -23,13 +23,15 @@ storiesOf("Table|Table", module)
};
}}
>
{(row: any) => <h2 style={{ color: "red" }}>{row.second}</h2>}
{(row: any) => <b style={{ color: "red" }}>{row.lastname}</b>}
</Column>
<Column header={"E-Mail"}>{(row: any) => <a>{row.email}</a>}</Column>
</Table>
))
.add("TextColumn", () => (
<Table data={[{ first: "d", second: "y" }, { first: "a", second: "b" }, { first: "z", second: "a" }]}>
<TextColumn header={"FIRST"} dataKey={"first"} />
<TextColumn header={"SECOND"} dataKey={"second"} />
<Table data={[{ id: "21", title: "Pommes", desc: "Fried potato sticks" },{ id: "42", title: "Quarter-Pounder", desc: "Big burger" }, {id: "-84", title: "Icecream", desc: "Cold dessert"}]}>
<TextColumn header={"Id"} dataKey={"id"} />
<TextColumn header={"Name"} dataKey={"title"} />
<TextColumn header={"Description"} dataKey={"desc"} />
</Table>
));