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 21:46:01 +08:00
committed by Allen
parent ae5c677854
commit f9ccbd0717
24 changed files with 128 additions and 296 deletions

View File

@@ -1,23 +1,10 @@
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: `Item name ${id}`,
price: 2100 + i
});
}
}
addProducts(5);
const products = productsGenerator();
const columns = [{
dataField: 'id',

View File

@@ -1,23 +1,10 @@
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: `Item name ${id}`,
price: 2100 + i
});
}
}
addProducts(5);
const products = productsGenerator();
const columns = [{
dataField: 'id',

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { BootstrapTableful } from 'react-bootstrap-table2';
import Code from 'common/codeBlock';
import Code from 'components/common/code-block';
const columns = [{
dataField: 'id',

View File

@@ -1,23 +1,10 @@
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: `Item name ${id}`,
price: 2100 + i
});
}
}
addProducts(5);
const products = productsGenerator();
const columns = [{
dataField: 'id',