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

Commit

Permalink
Add knobs for remaining props in Table
Browse files Browse the repository at this point in the history
  • Loading branch information
Coteh committed Aug 22, 2020
1 parent dced409 commit 0682a5a
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion story/src/2-Table.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import React from 'react';
import { Table } from '../../frontend/src/component/ui/Table';
import { array, number } from '@storybook/addon-knobs';
import { array, number, text, select } from '@storybook/addon-knobs';

export default {
title: 'UI/Table',
component: Table
};

function alignSelector(label: string) {
return select(
label,
{
center: 'center',
end: 'end',
justify: 'justify',
left: 'left',
'match-parent': 'match-parent',
right: 'right',
start: 'start'
},
'left'
);
}

export const table = () => {
const headers = array('Header Columns', ['Long Link', 'Alias']);
return (
Expand All @@ -15,6 +31,16 @@ export const table = () => {
rows={new Array(number('Number of rows', 2))
.fill(0)
.map((_, i) => headers.map((_, j) => `data ${i}-${j}`))}
headerFontSize={`${number('Header Font Size (px)', 16)}px`}
widths={headers.map(
(_, i) => number(`Column ${i + 1} Width (%)`, 50) + '%'
)}
alignHeaders={headers.map((_, i) =>
alignSelector(`Column ${i + 1} Header Alignment (%)`)
)}
alignBodyColumns={headers.map((_, i) =>
alignSelector(`Column ${i + 1} Body Column Alignment (%)`)
)}
/>
);
};

0 comments on commit 0682a5a

Please sign in to comment.