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

@@ -2322,7 +2322,7 @@ exports[`Storyshots Table|Table Default 1`] = `
onMouseEnter={[Function]} onMouseEnter={[Function]}
onMouseLeave={[Function]} onMouseLeave={[Function]}
> >
FIRST First Name
</th> </th>
<th <th
className="has-cursor-pointer" className="has-cursor-pointer"
@@ -2330,48 +2330,64 @@ exports[`Storyshots Table|Table Default 1`] = `
onMouseEnter={[Function]} onMouseEnter={[Function]}
onMouseLeave={[Function]} onMouseLeave={[Function]}
> >
SECOND Last Name
<i <i
className="fas fa-sort-amount-down has-text-grey-light sc-hzDkRC escBde" className="fas fa-sort-amount-down has-text-grey-light sc-hzDkRC escBde"
/> />
</th> </th>
<th
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
E-Mail
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td> <td>
<h1> <h4>
dddd Tricia
</h1> </h4>
</td> </td>
<td> <td>
<h2 <b
style={ style={
Object { Object {
"color": "red", "color": "red",
} }
} }
> >
xyz McMillan
</h2> </b>
</td>
<td>
<a>
tricia@hitchhiker.com
</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<h1> <h4>
abc Arthur
</h1> </h4>
</td> </td>
<td> <td>
<h2 <b
style={ style={
Object { Object {
"color": "red", "color": "red",
} }
} }
> >
bbbb Dent
</h2> </b>
</td>
<td>
<a>
arthur@hitchhiker.com
</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -2390,7 +2406,7 @@ exports[`Storyshots Table|Table TextColumn 1`] = `
onMouseEnter={[Function]} onMouseEnter={[Function]}
onMouseLeave={[Function]} onMouseLeave={[Function]}
> >
FIRST Id
<i <i
className="fas fa-sort-alpha-down has-text-grey-light sc-hzDkRC escBde" className="fas fa-sort-alpha-down has-text-grey-light sc-hzDkRC escBde"
/> />
@@ -2401,7 +2417,18 @@ exports[`Storyshots Table|Table TextColumn 1`] = `
onMouseEnter={[Function]} onMouseEnter={[Function]}
onMouseLeave={[Function]} onMouseLeave={[Function]}
> >
SECOND Name
<i
className="fas fa-sort-alpha-down has-text-grey-light sc-hzDkRC escBde"
/>
</th>
<th
className="has-cursor-pointer"
onClick={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Description
<i <i
className="fas fa-sort-alpha-down has-text-grey-light sc-hzDkRC escBde" className="fas fa-sort-alpha-down has-text-grey-light sc-hzDkRC escBde"
/> />
@@ -2411,26 +2438,35 @@ exports[`Storyshots Table|Table TextColumn 1`] = `
<tbody> <tbody>
<tr> <tr>
<td> <td>
d 21
</td> </td>
<td> <td>
y Pommes
</td>
<td>
Fried potato sticks
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
a 42
</td> </td>
<td> <td>
b Quarter-Pounder
</td>
<td>
Big burger
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
z -84
</td> </td>
<td> <td>
a Icecream
</td>
<td>
Cold dessert
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@@ -7,15 +7,15 @@ import { ColumnProps } from "./table";
storiesOf("Table|Table", module) storiesOf("Table|Table", module)
.add("Default", () => ( .add("Default", () => (
<Table data={[{ first: "dddd", second: "xyz" }, { first: "abc", second: "bbbb" }]}> <Table data={[{ firstname: "Tricia", lastname: "McMillan", email: "tricia@hitchhiker.com" }, { firstname: "Arthur", lastname: "Dent", email: "arthur@hitchhiker.com" }]}>
<Column header={"FIRST"}>{(row: any) => <h1>{row.first}</h1>}</Column> <Column header={"First Name"}>{(row: any) => <h4>{row.firstname}</h4>}</Column>
<Column <Column
header={"SECOND"} header={"Last Name"}
createComparator={(props: ColumnProps, columnIndex: number) => { createComparator={(props: ColumnProps, columnIndex: number) => {
return (a: any, b: any) => { return (a: any, b: any) => {
if (a.second > b.second) { if (a.lastname > b.lastname) {
return -1; return -1;
} else if (a.second < b.second) { } else if (a.lastname < b.lastname) {
return 1; return 1;
} else { } else {
return 0; 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>
<Column header={"E-Mail"}>{(row: any) => <a>{row.email}</a>}</Column>
</Table> </Table>
)) ))
.add("TextColumn", () => ( .add("TextColumn", () => (
<Table data={[{ first: "d", second: "y" }, { first: "a", second: "b" }, { first: "z", second: "a" }]}> <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={"FIRST"} dataKey={"first"} /> <TextColumn header={"Id"} dataKey={"id"} />
<TextColumn header={"SECOND"} dataKey={"second"} /> <TextColumn header={"Name"} dataKey={"title"} />
<TextColumn header={"Description"} dataKey={"desc"} />
</Table> </Table>
)); ));