react-tradeshift-ui
Advanced tools
Comparing version 2.1.0 to 2.2.0
{ | ||
"name": "react-tradeshift-ui", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"main": "dist/components.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/components.js", |
@@ -13,11 +13,7 @@ import React, { useEffect } from 'react'; | ||
table.rows(rows); | ||
if (!_.isNil(pager) && pager.pages > 1) { | ||
if (pager.pages > 1) { | ||
table.pager(pager); | ||
} | ||
if (!_.isNil(onbutton)) { | ||
table.onbutton = onbutton; | ||
} | ||
if (!_.isNil(linkable)) { | ||
table.linkable = linkable; | ||
} | ||
table.onbutton = onbutton; | ||
table.linkable(linkable); | ||
}); | ||
@@ -39,3 +35,3 @@ }; | ||
linkable: () => {}, | ||
pager: {}, | ||
pager: { pages: 0, page: 0, onselect: () => {} }, | ||
className: '', | ||
@@ -42,0 +38,0 @@ selectable: false, |
@@ -7,7 +7,7 @@ import React from 'react'; | ||
const stories = storiesOf('Table', module); | ||
const tableConfig = { | ||
cols: [{ label: 'One' }, { label: 'Two' }, { label: 'Three' }], | ||
rows: [['A', 'D', 'G'], ['B', 'E', 'H'], ['C', 'F', 'I']] | ||
}; | ||
stories.add('Basic usage', () => { | ||
const tableConfig = { | ||
cols: [{ label: 'One' }, { label: 'Two' }, { label: 'Three' }], | ||
rows: [['A', 'D', 'G'], ['B', 'E', 'H'], ['C', 'F', 'I']] | ||
}; | ||
const shouldShow = boolean('shouldShow', false); | ||
@@ -20,1 +20,48 @@ return shouldShow ? ( | ||
}); | ||
stories.add('Linkable table element', () => { | ||
const tableConfig = { | ||
cols: [{ label: 'name' }, { label: 'gender' }, { label: 'action' }], | ||
rows: [ | ||
[ | ||
'Tom', | ||
'Male', | ||
{ | ||
text: '[sayHello](sayHello)', | ||
type: 'say-hello' | ||
} | ||
], | ||
[ | ||
'Lucy', | ||
'Female', | ||
{ | ||
text: '[sayHello](sayHello)', | ||
type: 'say-hello' | ||
} | ||
], | ||
[ | ||
'Li Lei', | ||
'Male', | ||
{ | ||
text: '[sayHello](sayHello)', | ||
type: 'say-hello' | ||
} | ||
] | ||
] | ||
}; | ||
const handleLinkable = action => { | ||
if (action === 'sayHello') { | ||
window.ts.ui.Notification.info('hello'); | ||
} | ||
}; | ||
const shouldShow = boolean('shouldShow', false); | ||
return shouldShow ? ( | ||
<div style={{ height: 200 }}> | ||
<Table | ||
id="profile-table" | ||
cols={tableConfig.cols} | ||
rows={tableConfig.rows} | ||
linkable={handleLinkable} | ||
/> | ||
</div> | ||
) : null; | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
172389
1911