Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

Commit 0682a5a

Browse files
committed
Add knobs for remaining props in Table
1 parent dced409 commit 0682a5a

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

story/src/2-Table.stories.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
import React from 'react';
22
import { Table } from '../../frontend/src/component/ui/Table';
3-
import { array, number } from '@storybook/addon-knobs';
3+
import { array, number, text, select } from '@storybook/addon-knobs';
44

55
export default {
66
title: 'UI/Table',
77
component: Table
88
};
99

10+
function alignSelector(label: string) {
11+
return select(
12+
label,
13+
{
14+
center: 'center',
15+
end: 'end',
16+
justify: 'justify',
17+
left: 'left',
18+
'match-parent': 'match-parent',
19+
right: 'right',
20+
start: 'start'
21+
},
22+
'left'
23+
);
24+
}
25+
1026
export const table = () => {
1127
const headers = array('Header Columns', ['Long Link', 'Alias']);
1228
return (
@@ -15,6 +31,16 @@ export const table = () => {
1531
rows={new Array(number('Number of rows', 2))
1632
.fill(0)
1733
.map((_, i) => headers.map((_, j) => `data ${i}-${j}`))}
34+
headerFontSize={`${number('Header Font Size (px)', 16)}px`}
35+
widths={headers.map(
36+
(_, i) => number(`Column ${i + 1} Width (%)`, 50) + '%'
37+
)}
38+
alignHeaders={headers.map((_, i) =>
39+
alignSelector(`Column ${i + 1} Header Alignment (%)`)
40+
)}
41+
alignBodyColumns={headers.map((_, i) =>
42+
alignSelector(`Column ${i + 1} Body Column Alignment (%)`)
43+
)}
1844
/>
1945
);
2046
};

0 commit comments

Comments
 (0)