@@ -27,11 +27,28 @@ import { responsiveSize } from "styles/responsiveSize";
27
27
28
28
import StatDisplay , { IStatDisplay } from "components/StatDisplay" ;
29
29
import { StyledSkeleton } from "components/StyledSkeleton" ;
30
- // import { useHomePageBlockQuery } from "queries/useHomePageBlockQuery";
31
30
import { commify } from "utils/commify" ;
32
- import { DropdownSelect } from "@kleros/ui-components-library" ;
31
+ import { CustomAccordion , DropdownSelect } from "@kleros/ui-components-library" ;
33
32
import { useHomePageExtraStats } from "queries/useHomePageExtraStats" ;
34
33
34
+ const StyledAccordion = styled ( CustomAccordion ) `
35
+ width: 100%;
36
+ margin-bottom: 12px;
37
+ > * > button {
38
+ justify-content: unset;
39
+ background-color: ${ ( { theme } ) => theme . whiteBackground } !important;
40
+ border: 1px solid ${ ( { theme } ) => theme . stroke } !important;
41
+ color: ${ ( { theme } ) => theme . primaryText } !important;
42
+ > svg {
43
+ fill: ${ ( { theme } ) => theme . primaryText } !important;
44
+ }
45
+ }
46
+ //adds padding to body container
47
+ > * > div > div {
48
+ padding: 0;
49
+ }
50
+ ` ;
51
+
35
52
function beautifyStatNumber ( value : number ) : string {
36
53
const absValue = Math . abs ( value ) ;
37
54
@@ -242,52 +259,61 @@ const Stats = () => {
242
259
} ;
243
260
244
261
return (
245
- < >
246
- < AllTimeContainer >
247
- < StyledChartIcon />
248
- < StyledAllTimeText > All time</ StyledAllTimeText >
249
- </ AllTimeContainer >
250
- < StyledCard >
251
- { stats . map ( ( { title, coinId, getText, getSubtext, color, icon } , i ) => {
252
- const coinPrice = ! isUndefined ( pricesData ) ? pricesData [ coinIds [ coinId ! ] ] ?. price : undefined ;
253
- return (
254
- < StatDisplay
255
- key = { i }
256
- { ...{ title, color, icon } }
257
- text = { data ? getText ( data . court ) : < StyledSkeleton /> }
258
- subtext = { calculateSubtextRender ( data ?. court , getSubtext , coinPrice ) }
259
- />
260
- ) ;
261
- } ) }
262
- </ StyledCard >
263
- < TimeSelectorContainer >
264
- < StyledChartIcon />
265
- < StyledAllTimeText >
266
- < DropdownSelect
267
- smallButton
268
- simpleButton
269
- items = { timeRanges . map ( ( range ) => ( {
270
- value : range . value ,
271
- text : range . text ,
272
- } ) ) }
273
- defaultValue = { selectedRange }
274
- callback = { handleTimeRangeChange }
275
- />
276
- </ StyledAllTimeText >
277
- </ TimeSelectorContainer >
278
- < StyledCard >
279
- { timeframedStats . map ( ( { title, getText, getSubtext, color, icon } , i ) => {
280
- return (
281
- < StatDisplay
282
- key = { i }
283
- { ...{ title, color, icon } }
284
- text = { foundCourt ? getText ( foundCourt ) : < StyledSkeleton /> }
285
- subtext = { calculateSubtextRender ( foundCourt , getSubtext ) }
286
- />
287
- ) ;
288
- } ) }
289
- </ StyledCard >
290
- </ >
262
+ < StyledAccordion
263
+ items = { [
264
+ {
265
+ title : "Statistics" ,
266
+ body : (
267
+ < >
268
+ < AllTimeContainer >
269
+ < StyledChartIcon />
270
+ < StyledAllTimeText > All time</ StyledAllTimeText >
271
+ </ AllTimeContainer >
272
+ < StyledCard >
273
+ { stats . map ( ( { title, coinId, getText, getSubtext, color, icon } , i ) => {
274
+ const coinPrice = ! isUndefined ( pricesData ) ? pricesData [ coinIds [ coinId ! ] ] ?. price : undefined ;
275
+ return (
276
+ < StatDisplay
277
+ key = { i }
278
+ { ...{ title, color, icon } }
279
+ text = { data ? getText ( data . court ) : < StyledSkeleton /> }
280
+ subtext = { calculateSubtextRender ( data ?. court , getSubtext , coinPrice ) }
281
+ />
282
+ ) ;
283
+ } ) }
284
+ </ StyledCard >
285
+ < TimeSelectorContainer >
286
+ < StyledChartIcon />
287
+ < StyledAllTimeText >
288
+ < DropdownSelect
289
+ smallButton
290
+ simpleButton
291
+ items = { timeRanges . map ( ( range ) => ( {
292
+ value : range . value ,
293
+ text : range . text ,
294
+ } ) ) }
295
+ defaultValue = { selectedRange }
296
+ callback = { handleTimeRangeChange }
297
+ />
298
+ </ StyledAllTimeText >
299
+ </ TimeSelectorContainer >
300
+ < StyledCard >
301
+ { timeframedStats . map ( ( { title, getText, getSubtext, color, icon } , i ) => {
302
+ return (
303
+ < StatDisplay
304
+ key = { i }
305
+ { ...{ title, color, icon } }
306
+ text = { foundCourt ? getText ( foundCourt ) : < StyledSkeleton /> }
307
+ subtext = { calculateSubtextRender ( foundCourt , getSubtext ) }
308
+ />
309
+ ) ;
310
+ } ) }
311
+ </ StyledCard >
312
+ </ >
313
+ ) ,
314
+ } ,
315
+ ] }
316
+ > </ StyledAccordion >
291
317
) ;
292
318
} ;
293
319
0 commit comments