@@ -14,7 +14,7 @@ import { useTheme } from '@table-library/react-table-library/theme';
1414
1515import { 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 >
0 commit comments