@@ -29,75 +29,86 @@ storiesOf('Features/Column Grouping', module)
29
29
. add ( 'base' , ( ) => {
30
30
const data = { nodes } ;
31
31
32
- const theme = useTheme ( {
33
- HeaderRow : `
34
- & th.foo {
35
- color: white;
36
- background-color: blue;
37
- grid-column: 1 / span 2;
38
- }
39
-
40
- & th.bar {
41
- color: white;
42
- background-color: orange;
43
- grid-column: 3 / span 3;
44
- }
45
-
46
- & th.dissolve {
47
- display: none;
48
- }
49
- ` ,
50
- Row : `
51
- &:nth-of-type(odd) {
52
- .td:nth-of-type(2) {
53
- color: white;
54
- background-color: red;
55
- grid-column: 2 / span 2;
56
- }
57
- .td:nth-of-type(3) {
58
- display: none;
59
- }
60
- }
61
- ` ,
62
- } ) ;
63
-
64
32
return (
65
- < Table data = { data } theme = { theme } >
33
+ < Table data = { data } >
66
34
{ ( tableList ) => (
67
35
< >
68
36
< Header >
69
37
< HeaderRow >
70
- < HeaderCell className = "foo" > Foo</ HeaderCell >
71
- < HeaderCell className = "dissolve" />
72
- < HeaderCell className = "bar" > Bar</ HeaderCell >
73
- < HeaderCell className = "dissolve" />
74
- < HeaderCell className = "dissolve" />
75
- </ HeaderRow >
76
- < HeaderRow >
77
- < HeaderCell > Task</ HeaderCell >
78
- < HeaderCell > Deadline</ HeaderCell >
79
- < HeaderCell > Type</ HeaderCell >
80
- < HeaderCell > Complete</ HeaderCell >
38
+ < HeaderCell colSpan = { 2 } style = { { backgroundColor : 'blue' , color : 'white' } } >
39
+ Task
40
+ </ HeaderCell >
41
+ < HeaderCell colSpan = { 2 } style = { { backgroundColor : 'green' , color : 'white' } } >
42
+ Type
43
+ </ HeaderCell >
81
44
< HeaderCell > Tasks</ HeaderCell >
82
45
</ HeaderRow >
83
46
</ Header >
84
47
85
48
< Body >
86
- { tableList . map ( ( item ) => (
87
- < Row key = { item . id } item = { item } >
88
- < Cell > { item . name } </ Cell >
89
- < Cell >
90
- { item . deadline . toLocaleDateString ( 'en-US' , {
91
- year : 'numeric' ,
92
- month : '2-digit' ,
93
- day : '2-digit' ,
94
- } ) }
95
- </ Cell >
96
- < Cell > { item . type } </ Cell >
97
- < Cell > { item . isComplete . toString ( ) } </ Cell >
98
- < Cell > { item . nodes ?. length } </ Cell >
99
- </ Row >
100
- ) ) }
49
+ { tableList . map ( ( item , index ) =>
50
+ index === 1 ? (
51
+ < Row key = { item . id } item = { item } >
52
+ < Cell colSpan = { 3 } style = { { backgroundColor : 'red' , color : 'white' } } >
53
+ { item . name }
54
+ </ Cell >
55
+ < Cell > { item . isComplete . toString ( ) } </ Cell >
56
+ < Cell > { item . nodes ?. length } </ Cell >
57
+ </ Row >
58
+ ) : index === 2 ? (
59
+ < Row key = { item . id } item = { item } >
60
+ < Cell > { item . name } </ Cell >
61
+ < Cell >
62
+ { item . deadline . toLocaleDateString ( 'en-US' , {
63
+ year : 'numeric' ,
64
+ month : '2-digit' ,
65
+ day : '2-digit' ,
66
+ } ) }
67
+ </ Cell >
68
+ < Cell > { item . type } </ Cell >
69
+ < Cell colSpan = { 2 } style = { { backgroundColor : 'blue' , color : 'white' } } >
70
+ { item . isComplete . toString ( ) }
71
+ </ Cell >
72
+ </ Row >
73
+ ) : index === 3 ? (
74
+ < Row key = { item . id } item = { item } >
75
+ < Cell > { item . name } </ Cell >
76
+ < Cell colSpan = { 2 } style = { { backgroundColor : 'orange' , color : 'white' } } >
77
+ { item . deadline . toLocaleDateString ( 'en-US' , {
78
+ year : 'numeric' ,
79
+ month : '2-digit' ,
80
+ day : '2-digit' ,
81
+ } ) }
82
+ </ Cell >
83
+ < Cell > { item . isComplete . toString ( ) } </ Cell >
84
+ < Cell > { item . nodes ?. length } </ Cell >
85
+ </ Row >
86
+ ) : index === 4 ? (
87
+ < Row key = { item . id } item = { item } >
88
+ < Cell colSpan = { 2 } style = { { backgroundColor : 'green' , color : 'white' } } >
89
+ { item . name }
90
+ </ Cell >
91
+ < Cell > { item . type } </ Cell >
92
+ < Cell colSpan = { 2 } style = { { backgroundColor : 'green' , color : 'white' } } >
93
+ { item . isComplete . toString ( ) }
94
+ </ Cell >
95
+ </ Row >
96
+ ) : (
97
+ < Row key = { item . id } item = { item } >
98
+ < Cell > { item . name } </ Cell >
99
+ < Cell >
100
+ { item . deadline . toLocaleDateString ( 'en-US' , {
101
+ year : 'numeric' ,
102
+ month : '2-digit' ,
103
+ day : '2-digit' ,
104
+ } ) }
105
+ </ Cell >
106
+ < Cell > { item . type } </ Cell >
107
+ < Cell > { item . isComplete . toString ( ) } </ Cell >
108
+ < Cell > { item . nodes ?. length } </ Cell >
109
+ </ Row >
110
+ ) ,
111
+ ) }
101
112
</ Body >
102
113
</ >
103
114
) }
0 commit comments