1- import { FC , useState } from 'react'
1+ import { FC } from 'react'
22import { useTranslation } from 'react-i18next'
3- import Box from '@mui/material/Box'
43import Card from '@mui/material/Card'
54import CardContent from '@mui/material/CardContent'
65import Link from '@mui/material/Link'
76import { Skeleton } from '@oasisprotocol/ui-library/src/components/ui/skeleton'
8- import Tabs from '@mui/material/Tabs'
9- import Tab from '@mui/material/Tab'
7+ import { Tabs , TabsContent , TabsList , TabsTrigger } from '@oasisprotocol/ui-library/src/components/tabs'
108import { styled } from '@mui/material/styles'
119import {
1210 Account ,
@@ -25,6 +23,9 @@ import { tableCellClasses } from '@mui/material/TableCell'
2523
2624export const StyledCard = styled ( Card ) ( ( { theme } ) => ( {
2725 flex : 1 ,
26+ borderTopRightRadius : 0 ,
27+ borderTopLeftRadius : 0 ,
28+ borderTop : 'none' ,
2829 '&' : {
2930 padding : `0 ${ theme . spacing ( 4 ) } ` ,
3031 marginBottom : 0 ,
@@ -41,22 +42,31 @@ type StakingProps = {
4142
4243export const Staking : FC < StakingProps > = ( { account, isLoading } ) => {
4344 const { t } = useTranslation ( )
44- const [ tab , setTabValue ] = useState ( 0 )
4545
4646 return (
47- < Box sx = { { display : 'flex' , flexDirection : 'column' , height : '100%' } } >
48- < Tabs value = { tab } onChange = { ( event , tab ) => setTabValue ( tab ) } aria-label = { t ( 'validator.delegations' ) } >
49- < Tab label = { t ( 'common.staked' ) } />
50- < Tab label = { t ( 'common.debonding' ) } />
47+ < div className = "flex flex-col h-full" >
48+ < Tabs defaultValue = "staked" className = "h-full" aria-label = { t ( 'validator.delegations' ) } >
49+ < TabsList variant = "layout" >
50+ < TabsTrigger value = "staked" > { t ( 'common.staked' ) } </ TabsTrigger >
51+ < TabsTrigger value = "debonding" > { t ( 'common.debonding' ) } </ TabsTrigger >
52+ </ TabsList >
53+ < StyledCard >
54+ < CardContent >
55+ { isLoading && < Skeleton className = "h-[300px] mt-8" /> }
56+ { ! isLoading && account && (
57+ < >
58+ < TabsContent value = "staked" >
59+ < ActiveDelegations address = { account ?. address } />
60+ </ TabsContent >
61+ < TabsContent value = "debonding" >
62+ < DebondingDelegations address = { account ?. address } />
63+ </ TabsContent >
64+ </ >
65+ ) }
66+ </ CardContent >
67+ </ StyledCard >
5168 </ Tabs >
52- < StyledCard >
53- < CardContent >
54- { isLoading && < Skeleton className = "h-[300px] mt-8" /> }
55- { account && tab === 0 && < ActiveDelegations address = { account ?. address } /> }
56- { account && tab === 1 && < DebondingDelegations address = { account ?. address } /> }
57- </ CardContent >
58- </ StyledCard >
59- </ Box >
69+ </ div >
6070 )
6171}
6272
0 commit comments