@@ -63,34 +63,34 @@ To learn how to use react-papaparse:
6363
6464![ basic-upload] ( https://react-papaparse.github.io/static/images/csvreader1.png )
6565
66- ``` javascript
67- import React , { CSSProperties } from ' react' ;
66+ ``` typescript
67+ import React from ' react' ;
6868
6969import { useCSVReader } from ' react-papaparse' ;
7070
71- const styles = {
71+ const styles: Record < string , React . CSSProperties > = {
7272 csvReader: {
7373 display: ' flex' ,
7474 flexDirection: ' row' ,
7575 marginBottom: 10 ,
76- } as CSSProperties ,
76+ },
7777 browseFile: {
7878 width: ' 20%' ,
79- } as CSSProperties ,
79+ },
8080 acceptedFile: {
8181 border: ' 1px solid #ccc' ,
8282 height: 45 ,
8383 lineHeight: 2.5 ,
8484 paddingLeft: 10 ,
8585 width: ' 80%' ,
86- } as CSSProperties ,
86+ },
8787 remove: {
8888 borderRadius: 0 ,
8989 padding: ' 0 20px' ,
90- } as CSSProperties ,
90+ },
9191 progressBarBackgroundColor: {
9292 backgroundColor: ' red' ,
93- } as CSSProperties ,
93+ },
9494};
9595
9696export default function CSVReader() {
@@ -129,8 +129,8 @@ export default function CSVReader() {
129129
130130![ click-and-drag-upload] ( https://react-papaparse.github.io/static/images/csvreader2.png )
131131
132- ``` javascript
133- import React , { useState , CSSProperties } from ' react' ;
132+ ``` typescript
133+ import React , { useState } from ' react' ;
134134
135135import {
136136 useCSVReader ,
@@ -147,7 +147,7 @@ const REMOVE_HOVER_COLOR_LIGHT = lightenDarkenColor(
147147);
148148const GREY_DIM = ' #686868' ;
149149
150- const styles = {
150+ const styles: Record < string , React . CSSProperties > = {
151151 zone: {
152152 alignItems: ' center' ,
153153 border: ` 2px dashed ${GREY } ` ,
@@ -157,7 +157,7 @@ const styles = {
157157 height: ' 100%' ,
158158 justifyContent: ' center' ,
159159 padding: 20 ,
160- } as CSSProperties ,
160+ },
161161 file: {
162162 background: ' linear-gradient(to bottom, #EEE, #DDD)' ,
163163 borderRadius: 20 ,
@@ -168,47 +168,47 @@ const styles = {
168168 zIndex: 10 ,
169169 flexDirection: ' column' ,
170170 justifyContent: ' center' ,
171- } as CSSProperties ,
171+ },
172172 info: {
173173 alignItems: ' center' ,
174174 display: ' flex' ,
175175 flexDirection: ' column' ,
176176 paddingLeft: 10 ,
177177 paddingRight: 10 ,
178- } as CSSProperties ,
178+ },
179179 size: {
180180 backgroundColor: GREY_LIGHT ,
181181 borderRadius: 3 ,
182182 marginBottom: ' 0.5em' ,
183183 justifyContent: ' center' ,
184184 display: ' flex' ,
185- } as CSSProperties ,
185+ },
186186 name: {
187187 backgroundColor: GREY_LIGHT ,
188188 borderRadius: 3 ,
189189 fontSize: 12 ,
190190 marginBottom: ' 0.5em' ,
191- } as CSSProperties ,
191+ },
192192 progressBar: {
193193 bottom: 14 ,
194194 position: ' absolute' ,
195195 width: ' 100%' ,
196196 paddingLeft: 10 ,
197197 paddingRight: 10 ,
198- } as CSSProperties ,
198+ },
199199 zoneHover: {
200200 borderColor: GREY_DIM ,
201- } as CSSProperties ,
201+ },
202202 default: {
203203 borderColor: GREY ,
204- } as CSSProperties ,
204+ },
205205 remove: {
206206 height: 23 ,
207207 position: ' absolute' ,
208208 right: 6 ,
209209 top: 6 ,
210210 width: 23 ,
211- } as CSSProperties ,
211+ },
212212};
213213
214214export default function CSVReader() {
@@ -294,8 +294,8 @@ export default function CSVReader() {
294294
295295![ drag-no-click-upload] ( https://react-papaparse.github.io/static/images/csvreader3.png )
296296
297- ``` javascript
298- import React , { useState , CSSProperties } from ' react' ;
297+ ``` typescript
298+ import React , { useState } from ' react' ;
299299
300300import {
301301 useCSVReader ,
@@ -312,7 +312,7 @@ const REMOVE_HOVER_COLOR_LIGHT = lightenDarkenColor(
312312);
313313const GREY_DIM = ' #686868' ;
314314
315- const styles = {
315+ const styles: Record < string , React . CSSProperties > = {
316316 zone: {
317317 alignItems: ' center' ,
318318 border: ` 2px dashed ${GREY } ` ,
@@ -322,7 +322,7 @@ const styles = {
322322 height: ' 100%' ,
323323 justifyContent: ' center' ,
324324 padding: 20 ,
325- } as CSSProperties ,
325+ },
326326 file: {
327327 background: ' linear-gradient(to bottom, #EEE, #DDD)' ,
328328 borderRadius: 20 ,
@@ -333,47 +333,47 @@ const styles = {
333333 zIndex: 10 ,
334334 flexDirection: ' column' ,
335335 justifyContent: ' center' ,
336- } as CSSProperties ,
336+ },
337337 info: {
338338 alignItems: ' center' ,
339339 display: ' flex' ,
340340 flexDirection: ' column' ,
341341 paddingLeft: 10 ,
342342 paddingRight: 10 ,
343- } as CSSProperties ,
343+ },
344344 size: {
345345 backgroundColor: GREY_LIGHT ,
346346 borderRadius: 3 ,
347347 marginBottom: ' 0.5em' ,
348348 justifyContent: ' center' ,
349349 display: ' flex' ,
350- } as CSSProperties ,
350+ },
351351 name: {
352352 backgroundColor: GREY_LIGHT ,
353353 borderRadius: 3 ,
354354 fontSize: 12 ,
355355 marginBottom: ' 0.5em' ,
356- } as CSSProperties ,
356+ },
357357 progressBar: {
358358 bottom: 14 ,
359359 position: ' absolute' ,
360360 width: ' 100%' ,
361361 paddingLeft: 10 ,
362362 paddingRight: 10 ,
363- } as CSSProperties ,
363+ },
364364 zoneHover: {
365365 borderColor: GREY_DIM ,
366- } as CSSProperties ,
366+ },
367367 default: {
368368 borderColor: GREY ,
369- } as CSSProperties ,
369+ },
370370 remove: {
371371 height: 23 ,
372372 position: ' absolute' ,
373373 right: 6 ,
374374 top: 6 ,
375375 width: 23 ,
376- } as CSSProperties ,
376+ },
377377};
378378
379379export default function CSVReader() {
@@ -460,8 +460,8 @@ export default function CSVReader() {
460460
461461![ click-no-drag-upload] ( https://react-papaparse.github.io/static/images/csvreader4.png )
462462
463- ``` javascript
464- import React , { useState , CSSProperties } from ' react' ;
463+ ``` typescript
464+ import React , { useState } from ' react' ;
465465
466466import {
467467 useCSVReader ,
@@ -478,7 +478,7 @@ const REMOVE_HOVER_COLOR_LIGHT = lightenDarkenColor(
478478);
479479const GREY_DIM = ' #686868' ;
480480
481- const styles = {
481+ const styles: Record < string , React . CSSProperties > = {
482482 zone: {
483483 alignItems: ' center' ,
484484 border: ` 2px dashed ${GREY } ` ,
@@ -488,7 +488,7 @@ const styles = {
488488 height: ' 100%' ,
489489 justifyContent: ' center' ,
490490 padding: 20 ,
491- } as CSSProperties ,
491+ },
492492 file: {
493493 background: ' linear-gradient(to bottom, #EEE, #DDD)' ,
494494 borderRadius: 20 ,
@@ -499,47 +499,47 @@ const styles = {
499499 zIndex: 10 ,
500500 flexDirection: ' column' ,
501501 justifyContent: ' center' ,
502- } as CSSProperties ,
502+ },
503503 info: {
504504 alignItems: ' center' ,
505505 display: ' flex' ,
506506 flexDirection: ' column' ,
507507 paddingLeft: 10 ,
508508 paddingRight: 10 ,
509- } as CSSProperties ,
509+ },
510510 size: {
511511 backgroundColor: GREY_LIGHT ,
512512 borderRadius: 3 ,
513513 marginBottom: ' 0.5em' ,
514514 justifyContent: ' center' ,
515515 display: ' flex' ,
516- } as CSSProperties ,
516+ },
517517 name: {
518518 backgroundColor: GREY_LIGHT ,
519519 borderRadius: 3 ,
520520 fontSize: 12 ,
521521 marginBottom: ' 0.5em' ,
522- } as CSSProperties ,
522+ },
523523 progressBar: {
524524 bottom: 14 ,
525525 position: ' absolute' ,
526526 width: ' 100%' ,
527527 paddingLeft: 10 ,
528528 paddingRight: 10 ,
529- } as CSSProperties ,
529+ },
530530 zoneHover: {
531531 borderColor: GREY_DIM ,
532- } as CSSProperties ,
532+ },
533533 default: {
534534 borderColor: GREY ,
535- } as CSSProperties ,
535+ },
536536 remove: {
537537 height: 23 ,
538538 position: ' absolute' ,
539539 right: 6 ,
540540 top: 6 ,
541541 width: 23 ,
542- } as CSSProperties ,
542+ },
543543};
544544
545545export default function CSVReader() {
0 commit comments