Skip to content

Commit 2e6ea66

Browse files
committed
fix(colSpan): use different props
1 parent 0607b4a commit 2e6ea66

File tree

17 files changed

+61
-439
lines changed

17 files changed

+61
-439
lines changed

.storybook/preview.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const Features = [
2424
'Column Hiding',
2525
'Column Replace',
2626
'Column Ordering',
27-
'Column Grouping (WIP)',
2827
];
2928

3029
export const parameters = {
@@ -64,7 +63,7 @@ export const parameters = {
6463
'CRUD',
6564
['Create', 'Update', 'Delete'],
6665
'Misc',
67-
['Cell', 'Row', 'Table', 'Column', 'Footer', 'Actions'],
66+
['Cell', 'Row', 'Table', 'Column', 'Footer', 'Actions', 'Cell Grouping'],
6867
'Recipes',
6968
['Controlled'],
7069
'Client vs Server',

.storybook/stories/Compact/column-group.js

Lines changed: 0 additions & 91 deletions
This file was deleted.

.storybook/stories/Compact/index.story.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import * as EditableStory from './editable';
2222
// import * as DataGridStory from './data-grid';
2323
import * as ColumnHideStory from './column-hide';
2424
import * as ColumnOrderStory from './column-order';
25-
import * as ColumnGroupStory from './column-group';
2625

2726
const stories = [
2827
BaseStory,
@@ -44,7 +43,6 @@ const stories = [
4443
// DataGridStory,
4544
ColumnHideStory,
4645
ColumnOrderStory,
47-
ColumnGroupStory,
4846
];
4947

5048
const storyContainer = storiesOf('Compact Table', module).addParameters({

.storybook/stories/Features/column-group.story.js renamed to .storybook/stories/Misc/cell-grouping.story.js

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { useTheme } from '@table-library/react-table-library/theme';
1414

1515
import { nodes } from '../data';
1616

17-
storiesOf('Features/Column Grouping', module)
17+
storiesOf('Misc/Cell Grouping', module)
1818
.addParameters({
1919
component: Table,
2020
subcomponents: {
@@ -26,7 +26,7 @@ storiesOf('Features/Column Grouping', module)
2626
Cell,
2727
},
2828
})
29-
.add('base', () => {
29+
.add('by column', () => {
3030
const data = { nodes };
3131

3232
return (
@@ -35,10 +35,18 @@ storiesOf('Features/Column Grouping', module)
3535
<>
3636
<Header>
3737
<HeaderRow>
38-
<HeaderCell colSpan={2} style={{ backgroundColor: 'blue', color: 'white' }}>
38+
<HeaderCell
39+
gridColumnStart={1}
40+
gridColumnEnd={3}
41+
style={{ backgroundColor: 'blue', color: 'white' }}
42+
>
3943
Task
4044
</HeaderCell>
41-
<HeaderCell colSpan={2} style={{ backgroundColor: 'green', color: 'white' }}>
45+
<HeaderCell
46+
gridColumnStart={3}
47+
gridColumnEnd={5}
48+
style={{ backgroundColor: 'green', color: 'white' }}
49+
>
4250
Type
4351
</HeaderCell>
4452
<HeaderCell>Tasks</HeaderCell>
@@ -49,7 +57,11 @@ storiesOf('Features/Column Grouping', module)
4957
{tableList.map((item, index) =>
5058
index === 1 ? (
5159
<Row key={item.id} item={item}>
52-
<Cell colSpan={3} style={{ backgroundColor: 'red', color: 'white' }}>
60+
<Cell
61+
gridColumnStart={1}
62+
gridColumnEnd={4}
63+
style={{ backgroundColor: 'red', color: 'white' }}
64+
>
5365
{item.name}
5466
</Cell>
5567
<Cell>{item.isComplete.toString()}</Cell>
@@ -66,14 +78,22 @@ storiesOf('Features/Column Grouping', module)
6678
})}
6779
</Cell>
6880
<Cell>{item.type}</Cell>
69-
<Cell colSpan={2} style={{ backgroundColor: 'blue', color: 'white' }}>
81+
<Cell
82+
gridColumnStart={4}
83+
gridColumnEnd={6}
84+
style={{ backgroundColor: 'blue', color: 'white' }}
85+
>
7086
{item.isComplete.toString()}
7187
</Cell>
7288
</Row>
7389
) : index === 3 ? (
7490
<Row key={item.id} item={item}>
7591
<Cell>{item.name}</Cell>
76-
<Cell colSpan={2} style={{ backgroundColor: 'orange', color: 'white' }}>
92+
<Cell
93+
gridColumnStart={2}
94+
gridColumnEnd={4}
95+
style={{ backgroundColor: 'orange', color: 'white' }}
96+
>
7797
{item.deadline.toLocaleDateString('en-US', {
7898
year: 'numeric',
7999
month: '2-digit',
@@ -85,11 +105,19 @@ storiesOf('Features/Column Grouping', module)
85105
</Row>
86106
) : index === 4 ? (
87107
<Row key={item.id} item={item}>
88-
<Cell colSpan={2} style={{ backgroundColor: 'green', color: 'white' }}>
108+
<Cell
109+
gridColumnStart={1}
110+
gridColumnEnd={3}
111+
style={{ backgroundColor: 'green', color: 'white' }}
112+
>
89113
{item.name}
90114
</Cell>
91115
<Cell>{item.type}</Cell>
92-
<Cell colSpan={2} style={{ backgroundColor: 'green', color: 'white' }}>
116+
<Cell
117+
gridColumnStart={4}
118+
gridColumnEnd={6}
119+
style={{ backgroundColor: 'green', color: 'white' }}
120+
>
93121
{item.isComplete.toString()}
94122
</Cell>
95123
</Row>

.storybook/stories/Themes/Libraries/chakra-ui/column-group.js

Lines changed: 0 additions & 101 deletions
This file was deleted.

.storybook/stories/Themes/Libraries/chakra-ui/index.story.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import * as EditableStory from './editable';
2525
// import * as DataGridStory from './data-grid';
2626
import * as ColumnHideStory from './column-hide';
2727
import * as ColumnOrderStory from './column-order';
28-
import * as ColumnGroupStory from './column-group';
2928

3029
const stories = [
3130
BaseStory,
@@ -49,7 +48,6 @@ const stories = [
4948
// DataGridStory,
5049
ColumnHideStory,
5150
ColumnOrderStory,
52-
ColumnGroupStory,
5351
];
5452

5553
const storyContainer = storiesOf('Library Themes/Chakra UI', module).addParameters({

0 commit comments

Comments
 (0)