11import { Link , Page , Card , DataTable } from '@shopify/polaris' ;
2- import { useState , useCallback } from 'react' ;
2+ import { useState } from 'react' ;
33import { withPolarisExample } from '../../src/components/PolarisExampleWrapper' ;
44
5- function DataTableWithFixedFirstColumnExample ( ) {
5+ function DataTableWithFixedFirstColumnsExample ( ) {
66 const rows = [
77 [
88 < Link
@@ -16,6 +16,8 @@ function DataTableWithFixedFirstColumnExample() {
1616 124689 ,
1717 140 ,
1818 '$121,500.00' ,
19+ '$14,250.00' ,
20+ '$12,240.00' ,
1921 ] ,
2022 [
2123 < Link
@@ -29,6 +31,8 @@ function DataTableWithFixedFirstColumnExample() {
2931 124533 ,
3032 83 ,
3133 '$19,090.00' ,
34+ '$12,240.00' ,
35+ '$11,270.00' ,
3236 ] ,
3337 [
3438 < Link
@@ -42,6 +46,8 @@ function DataTableWithFixedFirstColumnExample() {
4246 124518 ,
4347 32 ,
4448 '$14,240.00' ,
49+ '$10,241.00' ,
50+ '$10,201.00' ,
4551 ] ,
4652 [
4753 < Link
@@ -55,6 +61,8 @@ function DataTableWithFixedFirstColumnExample() {
5561 124689 ,
5662 140 ,
5763 '$121,500.00' ,
64+ '$14,240.00' ,
65+ '$14,200.10' ,
5866 ] ,
5967 [
6068 < Link
@@ -68,6 +76,8 @@ function DataTableWithFixedFirstColumnExample() {
6876 124533 ,
6977 83 ,
7078 '$19,090.00' ,
79+ '$14,300.30' ,
80+ '$17,200.00' ,
7181 ] ,
7282 [
7383 < Link
@@ -81,6 +91,8 @@ function DataTableWithFixedFirstColumnExample() {
8191 124518 ,
8292 32 ,
8393 '$14,240.00' ,
94+ '$18,770.07' ,
95+ '$15,545.00' ,
8496 ] ,
8597 [
8698 < Link
@@ -94,6 +106,8 @@ function DataTableWithFixedFirstColumnExample() {
94106 124689 ,
95107 140 ,
96108 '$121,500.00' ,
109+ '$14,240.00' ,
110+ '$14,240.00' ,
97111 ] ,
98112 [
99113 < Link
@@ -107,6 +121,8 @@ function DataTableWithFixedFirstColumnExample() {
107121 124533 ,
108122 83 ,
109123 '$19,090.00' ,
124+ '$19,290.00' ,
125+ '$12,997.00' ,
110126 ] ,
111127 [
112128 < Link
@@ -120,6 +136,8 @@ function DataTableWithFixedFirstColumnExample() {
120136 124518 ,
121137 32 ,
122138 '$14,240.00' ,
139+ '$11,211.20' ,
140+ '$11,343.50' ,
123141 ] ,
124142 [
125143 < Link
@@ -133,6 +151,8 @@ function DataTableWithFixedFirstColumnExample() {
133151 124689 ,
134152 140 ,
135153 '$121,500.00' ,
154+ '$12,430.00' ,
155+ '$17,420.00' ,
136156 ] ,
137157 [
138158 < Link
@@ -146,6 +166,8 @@ function DataTableWithFixedFirstColumnExample() {
146166 124533 ,
147167 83 ,
148168 '$19,090.00' ,
169+ '$14,790.00' ,
170+ '$12,370.00' ,
149171 ] ,
150172 [
151173 < Link
@@ -159,6 +181,8 @@ function DataTableWithFixedFirstColumnExample() {
159181 124518 ,
160182 32 ,
161183 '$14,240.00' ,
184+ '$16,241.00' ,
185+ '$18,211.00' ,
162186 ] ,
163187 [
164188 < Link
@@ -172,6 +196,8 @@ function DataTableWithFixedFirstColumnExample() {
172196 124689 ,
173197 140 ,
174198 '$121,500.00' ,
199+ '$15,111.00' ,
200+ '$11,221.00' ,
175201 ] ,
176202 [
177203 < Link
@@ -185,6 +211,8 @@ function DataTableWithFixedFirstColumnExample() {
185211 124533 ,
186212 83 ,
187213 '$19,090.00' ,
214+ '$17,880.00' ,
215+ '$11,280.00' ,
188216 ] ,
189217 [
190218 < Link
@@ -198,6 +226,8 @@ function DataTableWithFixedFirstColumnExample() {
198226 124518 ,
199227 32 ,
200228 '$14,240.00' ,
229+ '$11,111.00' ,
230+ '$17,211.00' ,
201231 ] ,
202232 [
203233 < Link
@@ -211,6 +241,8 @@ function DataTableWithFixedFirstColumnExample() {
211241 124689 ,
212242 140 ,
213243 '$121,500.00' ,
244+ '$14,240.00' ,
245+ '$17,840.00' ,
214246 ] ,
215247 [
216248 < Link
@@ -224,6 +256,8 @@ function DataTableWithFixedFirstColumnExample() {
224256 124533 ,
225257 83 ,
226258 '$19,090.00' ,
259+ '$13,238.00' ,
260+ '$14,288.00' ,
227261 ] ,
228262 [
229263 < Link
@@ -237,9 +271,11 @@ function DataTableWithFixedFirstColumnExample() {
237271 124518 ,
238272 32 ,
239273 '$14,240.00' ,
274+ '$14,988.00' ,
275+ '$14,902.10' ,
240276 ] ,
241277 ] ;
242- const [ sortedRows , setSortedRows ] = useState < any [ ] > ( rows ) ;
278+ const [ sortedRows , setSortedRows ] = useState ( rows ) ;
243279
244280 return (
245281 < Page title = "Sales by product" >
@@ -251,17 +287,21 @@ function DataTableWithFixedFirstColumnExample() {
251287 'numeric' ,
252288 'numeric' ,
253289 'numeric' ,
290+ 'numeric' ,
291+ 'numeric' ,
254292 ] }
255293 headings = { [
256294 'Product' ,
257295 'Price' ,
258296 'SKU Number' ,
259297 'Net quantity' ,
260298 'Net sales' ,
299+ 'Gross sales' ,
300+ 'Discounts' ,
261301 ] }
262302 rows = { sortedRows }
263- totals = { [ '' , '' , '' , 255 , '$155,830.00' ] }
264- sortable = { [ true , true , false , false , true ] }
303+ totals = { [ '' , '' , '' , 255 , '$155,830.00' , '' , '' ] }
304+ sortable = { [ false , true , false , false , true ] }
265305 defaultSortDirection = "descending"
266306 initialSortColumnIndex = { 4 }
267307 onSort = { ( index , direction ) => {
@@ -286,11 +326,11 @@ function DataTableWithFixedFirstColumnExample() {
286326 } }
287327 footerContent = { `Showing ${ sortedRows . length } of ${ sortedRows . length } results` }
288328 stickyHeader
289- hasFixedFirstColumn
329+ fixedFirstColumns = { 2 }
290330 />
291331 </ Card >
292332 </ Page >
293333 ) ;
294334}
295335
296- export default withPolarisExample ( DataTableWithFixedFirstColumnExample ) ;
336+ export default withPolarisExample ( DataTableWithFixedFirstColumnsExample ) ;
0 commit comments