-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbase-table.stories.tsx
More file actions
66 lines (62 loc) · 1.94 KB
/
Copy pathbase-table.stories.tsx
File metadata and controls
66 lines (62 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React from 'react';
import { BaseTable, BaseTableProps } from './base-table';
import { Meta, StoryFn } from '@storybook/react';
import TableDataHeader from '../table-data-header/table-data-header';
import TableRow from '../table-row/table-row';
import TableData from '../table-data/table-data';
import BodyText from '../body-text/body-text';
import { PrecisionCase } from '../../utils/currency';
import Cspr from '../cspr/cspr';
import PageTile from '../page-tile/page-tile';
const mockedData = [
{ rank: 1, motes: '50000000000000', owner: 'konrad.cspr' },
{ rank: 2, motes: '482900000000000', owner: 'victoria.cspr' },
{ rank: 3, motes: '1000000', owner: 'ab.cspr' },
];
export default {
component: BaseTable,
title: 'Components/Table/Base Table',
args: {
renderDataHeaders: () => (
<TableRow>
<TableDataHeader>Rank</TableDataHeader>
<TableDataHeader align={'right'}>Balance</TableDataHeader>{' '}
<TableDataHeader>Owner</TableDataHeader>
</TableRow>
),
renderData: () => (
<>
{mockedData.map((data) => (
<TableRow>
<TableData>
<BodyText size={3}>{data.rank}</BodyText>
</TableData>
<TableData align={'right'}>
<BodyText size={3}>
<Cspr
motes={data.motes}
precisionCase={PrecisionCase.deployCost}
/>
</BodyText>
</TableData>
<TableData>
<BodyText size={3}>{data.owner}</BodyText>
</TableData>
</TableRow>
))}
</>
),
},
} as Meta<typeof BaseTable>;
const Template: StoryFn<typeof BaseTable> = (args: BaseTableProps) => {
return (
<PageTile>
<BaseTable
renderDataHeaders={args.renderDataHeaders}
renderData={args.renderData}
renderFooter={args.renderFooter}
/>
</PageTile>
);
};
export const Primary = Template.bind({});