11import { ReactNode } from 'react'
2- import Box from '@mui/material/Box'
32import Tooltip from '@mui/material/Tooltip'
4- import { styled } from '@mui/material/styles'
53import { COLORS } from '../../../styles/theme/colors'
4+ import { cn } from '@oasisprotocol/ui-library/src/lib/utils'
65
7- const StyledSquare = styled ( Box , {
8- shouldForwardProp : prop => prop !== 'success' ,
9- } ) ( ( { success } : { success ?: boolean } ) => {
10- return {
11- display : 'flex ',
12- width : '24px' ,
13- height : '24px' ,
14- borderRadius : '3px' ,
15- backgroundColor : success ? COLORS . eucalyptus : COLORS . errorIndicatorBackground ,
16- }
17- } )
6+ const Square = ( { success } : { success ?: boolean } ) => (
7+ < div
8+ className = { cn (
9+ 'w-6 h-6 rounded-[3px]' ,
10+ success ? 'bg-[color:var(--success-color)]' : 'bg-[color:var(--error-color)] ',
11+ ) }
12+ style = { {
13+ backgroundColor : success ? COLORS . eucalyptus : COLORS . errorIndicatorBackground ,
14+ } }
15+ />
16+ )
1817
1918type BlockStatsProps < T > = {
2019 data : T [ ]
@@ -39,25 +38,25 @@ export const BlockStats = <T extends { [key: string]: any }>({
3938
4039 return (
4140 < >
42- < Box sx = { { display : ' flex' , flexWrap : ' wrap' } } gap = { 2 } >
41+ < div className = " flex flex- wrap gap-1" >
4342 { data . map ( item => {
4443 const title = tooltipFormatter ? tooltipFormatter ( item [ dataKey ] . toString ( ) ) : item [ dataKey ]
4544 return (
4645 < Tooltip key = { item [ dataKey ] } title = { title } placement = "top" >
47- < StyledSquare success = { item [ statusKey ] } />
46+ < Square success = { item [ statusKey ] } />
4847 </ Tooltip >
4948 )
5049 } ) }
51- </ Box >
50+ </ div >
5251 { legendLabels && (
53- < Box pt = { 5 } sx = { { display : ' flex' } } >
54- < Box gap = { 3 } mr = { 4 } sx = { { display : 'flex' } } >
55- < StyledSquare success /> { legendLabels . success }
56- </ Box >
57- < Box gap = { 3 } sx = { { display : ' flex' } } >
58- < StyledSquare /> { legendLabels . fail }
59- </ Box >
60- </ Box >
52+ < div className = "pt-8 flex" >
53+ < div className = "flex gap-2 mr-4" >
54+ < Square success /> { legendLabels . success }
55+ </ div >
56+ < div className = " flex gap-2" >
57+ < Square /> { legendLabels . fail }
58+ </ div >
59+ </ div >
6160 ) }
6261 </ >
6362 )
0 commit comments