examples enhance

* utils for products generator

* load test for each *.test.js file in packages folder

* [test] unit test for utils/common

* refactor all products with productGenerator for all examples

* refactor folder structure

* move component <Code /> to src/components/common
* rename component file name
This commit is contained in:
ChunMing, Chen
2017-09-04 08:46:01 -05:00
committed by Allen
parent ae5c677854
commit f9ccbd0717
24 changed files with 128 additions and 296 deletions
@@ -1,27 +1,18 @@
import React from 'react';
import { BootstrapTableful } from 'react-bootstrap-table2';
import Code from 'common/codeBlock';
import Code from 'components/common/code-block';
import { productsGenerator } from 'utils/common';
const products = [];
function addProducts(quantity) {
const startId = products.length;
for (let i = 0; i < quantity; i += 1) {
const id = startId + i;
products.push({
id,
name: `User Name ${id}`,
phone: 21009831 + i,
address: {
city: 'New York',
postCode: '1111-4512'
}
});
const products = productsGenerator(5, (value, index) => ({
id: index,
name: `User Name ${index}`,
phone: 21009831 + index,
address: {
city: 'New York',
postCode: '1111-4512'
}
}
addProducts(5);
}));
const columns = [{
dataField: 'id',