mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-08-11 19:50:17 +00:00
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:
+10
-19
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user