Skip to content

Commit db84ecf

Browse files
alebrozzotannerlinsley
authored andcommitted
Fixed code highlights (TanStack#179)
1 parent 50668fe commit db84ecf

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

stories/CellRenderers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ const columns = [{
161161
162162
return (
163163
<ReactTable
164+
className='-striped -highlight'
164165
data={data}
165166
columns={columns}
166167
defaultPageSize={10}

stories/ControlledTable.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ class ControlledTable extends React.Component {
112112
constructor() {
113113
super()
114114
this.sortChange = this.sortChange.bind(this)
115-
this.pageChange = this.pageChange.bind(this)
116-
this.pageSizeChange = this.pageSizeChange.bind(this)
117115
this.state = {
118116
sorting: [],
119117
page: 0,

stories/Footers.js

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,52 @@ const columns = [{
8888
header: 'Name',
8989
columns: [{
9090
header: 'First Name',
91-
accessor: 'firstName'
91+
accessor: 'firstName',
92+
footer: (
93+
<span><strong>Popular:</strong> {
94+
_.first(
95+
_.reduce(
96+
_.map(
97+
_.groupBy(
98+
data, d => d.firstName
99+
)
100+
),
101+
(a, b) => a.length > b.length ? a : b
102+
)
103+
).firstName}
104+
</span>
105+
)
92106
}, {
93107
header: 'Last Name',
94108
id: 'lastName',
95-
accessor: d => d.lastName
109+
accessor: d => d.lastName,
110+
footer: (
111+
<span><strong>Longest:</strong> {
112+
_.reduce(
113+
_.map(
114+
_.groupBy(
115+
data, d => d.lastName
116+
),
117+
(d, key) => key
118+
),
119+
(a, b) => a.length > b.length ? a : b
120+
)}
121+
</span>
122+
)
96123
}]
97124
}, {
98125
header: 'Info',
99126
columns: [{
100127
header: 'Age',
101-
accessor: 'age'
128+
accessor: 'age',
129+
footer: <span><strong>Average:</strong> {_.round(_.mean(_.map(data, d => d.age)))}</span>
102130
}]
103131
}]
104132
105133
// Display your table!
106134
return (
107135
<ReactTable
136+
className='-striped -highlight'
108137
data={data}
109138
columns={columns}
110139
defaultPageSize={10}

stories/Simple.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const columns = [{
7777
// Display your table!
7878
return (
7979
<ReactTable
80+
className='-striped -highlight'
8081
data={data}
8182
columns={columns}
8283
defaultPageSize={10}

0 commit comments

Comments
 (0)