From d4ffc11f7e536b050d3e231b121ddadef836d896 Mon Sep 17 00:00:00 2001 From: Ymbere Xavier Date: Sun, 27 Oct 2019 23:08:58 -0300 Subject: [PATCH] Update storybook with the new props examples --- .../non-selectable-rows-class.js | 61 +++++++++++++++++++ .../non-selectable-rows-style.js | 61 +++++++++++++++++++ .../stories/index.js | 4 ++ 3 files changed, 126 insertions(+) create mode 100644 packages/react-bootstrap-table2-example/examples/row-selection/non-selectable-rows-class.js create mode 100644 packages/react-bootstrap-table2-example/examples/row-selection/non-selectable-rows-style.js diff --git a/packages/react-bootstrap-table2-example/examples/row-selection/non-selectable-rows-class.js b/packages/react-bootstrap-table2-example/examples/row-selection/non-selectable-rows-class.js new file mode 100644 index 0000000..a1a8df7 --- /dev/null +++ b/packages/react-bootstrap-table2-example/examples/row-selection/non-selectable-rows-class.js @@ -0,0 +1,61 @@ +import React from 'react'; + +import BootstrapTable from 'react-bootstrap-table-next'; +import Code from 'components/common/code-block'; +import { productsGenerator } from 'utils/common'; + +const products = productsGenerator(); + +const columns = [{ + dataField: 'id', + text: 'Product ID' +}, { + dataField: 'name', + text: 'Product Name' +}, { + dataField: 'price', + text: 'Product Price' +}]; + +const selectRow = { + mode: 'checkbox', + clickToSelect: true, + nonSelectable: [0, 2, 4], + nonSelectableClasses: 'row-index-bigger-than-2101' +}; + +const sourceCode = `\ +import BootstrapTable from 'react-bootstrap-table-next'; + +const columns = [{ + dataField: 'id', + text: 'Product ID' +}, { + dataField: 'name', + text: 'Product Name' +}, { + dataField: 'price', + text: 'Product Price' +}]; + +const selectRow = { + mode: 'checkbox', + clickToSelect: true, + nonSelectable: [0, 2, 4], + nonSelectableClasses: 'row-index-bigger-than-2101' +}; + + +`; + +export default () => ( +
+ + { sourceCode } +
+); diff --git a/packages/react-bootstrap-table2-example/examples/row-selection/non-selectable-rows-style.js b/packages/react-bootstrap-table2-example/examples/row-selection/non-selectable-rows-style.js new file mode 100644 index 0000000..d3fd7f0 --- /dev/null +++ b/packages/react-bootstrap-table2-example/examples/row-selection/non-selectable-rows-style.js @@ -0,0 +1,61 @@ +import React from 'react'; + +import BootstrapTable from 'react-bootstrap-table-next'; +import Code from 'components/common/code-block'; +import { productsGenerator } from 'utils/common'; + +const products = productsGenerator(); + +const columns = [{ + dataField: 'id', + text: 'Product ID' +}, { + dataField: 'name', + text: 'Product Name' +}, { + dataField: 'price', + text: 'Product Price' +}]; + +const selectRow = { + mode: 'checkbox', + clickToSelect: true, + nonSelectable: [0, 2, 4], + nonSelectableStyle: { backgroundColor: 'gray' } +}; + +const sourceCode = `\ +import BootstrapTable from 'react-bootstrap-table-next'; + +const columns = [{ + dataField: 'id', + text: 'Product ID' +}, { + dataField: 'name', + text: 'Product Name' +}, { + dataField: 'price', + text: 'Product Price' +}]; + +const selectRow = { + mode: 'checkbox', + clickToSelect: true, + nonSelectable: [0, 2, 4], + nonSelectableStyle: { backgroundColor: 'gray' } +}; + + +`; + +export default () => ( +
+ + { sourceCode } +
+); diff --git a/packages/react-bootstrap-table2-example/stories/index.js b/packages/react-bootstrap-table2-example/stories/index.js index 5587d0b..43baae6 100644 --- a/packages/react-bootstrap-table2-example/stories/index.js +++ b/packages/react-bootstrap-table2-example/stories/index.js @@ -151,6 +151,8 @@ import HeaderStyleTable from 'examples/row-selection/header-style'; import HideSelectAllTable from 'examples/row-selection/hide-select-all'; import CustomSelectionTable from 'examples/row-selection/custom-selection'; import NonSelectableRowsTable from 'examples/row-selection/non-selectable-rows'; +import NonSelectableRowsStyleTable from 'examples/row-selection/non-selectable-rows-style'; +import NonSelectableRowsClassTable from 'examples/row-selection/non-selectable-rows-class'; import SelectionBgColorTable from 'examples/row-selection/selection-bgcolor'; import SelectionHooks from 'examples/row-selection/selection-hooks'; import HideSelectionColumnTable from 'examples/row-selection/hide-selection-column'; @@ -408,6 +410,8 @@ storiesOf('Row Selection', module) .add('Custom Selection', () => ) .add('Selection Background Color', () => ) .add('Not Selectabled Rows', () => ) + .add('Not Selectabled Rows Style', () => ) + .add('Not Selectabled Rows Class', () => ) .add('Selection Hooks', () => ) .add('Hide Selection Column', () => ) .add('Custom Selection Column Style', () => )