Skip to content

Commit 7911d3e

Browse files
committed
Repace MUI tabs in RouterTabs
1 parent 9456c1e commit 7911d3e

4 files changed

Lines changed: 31 additions & 23 deletions

File tree

src/app/components/LinkableCardLayout/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ type LinkableCardLayoutProps = {
1313
}
1414
export const LinkableCardLayout: FC<LinkableCardLayoutProps> = ({ children, containerId, title, action }) => {
1515
return (
16-
<Card>
16+
<Card
17+
sx={{
18+
borderTopRightRadius: 0,
19+
borderTopLeftRadius: 0,
20+
borderTop: 'none',
21+
}}
22+
>
1723
<LinkableDiv id={containerId}>
1824
<CardHeader disableTypography component="h3" title={title} action={action} />
1925
</LinkableDiv>

src/app/components/RouterTabs/index.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useLocation, Outlet, useMatches } from 'react-router-dom'
22
import { NonScrollingRouterLink } from '../NonScrollingRouterLink'
3-
import Tabs from '@mui/material/Tabs'
4-
import Tab from '@mui/material/Tab'
3+
import { Tabs, TabsList, TabsTrigger } from '@oasisprotocol/ui-library/src/components/tabs'
54

65
type RouterTabsProps<Context> = {
76
tabs: {
@@ -29,18 +28,18 @@ export function RouterTabs<Context>({ tabs, context }: RouterTabsProps<Context>)
2928

3029
return (
3130
<>
32-
<Tabs value={targetTab?.to} variant="scrollable" scrollButtons={false}>
33-
{tabs
34-
.filter(tab => tab === targetTab || tab.visible !== false)
35-
.map(tab => (
36-
<Tab
37-
key={tab.to}
38-
component={NonScrollingRouterLink}
39-
value={tab.to}
40-
label={tab.label}
41-
to={tab.to}
42-
/>
43-
))}
31+
<Tabs value={targetTab?.to}>
32+
<TabsList variant="layout">
33+
{tabs
34+
.filter(tab => tab === targetTab || tab.visible !== false)
35+
.map(tab => (
36+
<TabsTrigger key={tab.to} value={tab.to} asChild>
37+
<NonScrollingRouterLink to={tab.to} className="flex items-center">
38+
{tab.label}
39+
</NonScrollingRouterLink>
40+
</TabsTrigger>
41+
))}
42+
</TabsList>
4443
</Tabs>
4544
<Outlet context={context} />
4645
</>

src/app/pages/ConsensusAccountDetailsPage/Staking.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ import { tableCellClasses } from '@mui/material/TableCell'
2323

2424
export const StyledCard = styled(Card)(({ theme }) => ({
2525
flex: 1,
26+
borderTopRightRadius: 0,
27+
borderTopLeftRadius: 0,
28+
borderTop: 'none',
2629
'&': {
2730
padding: `0 ${theme.spacing(4)}`,
2831
marginBottom: 0,
@@ -47,13 +50,7 @@ export const Staking: FC<StakingProps> = ({ account, isLoading }) => {
4750
<TabsTrigger value="staked">{t('common.staked')}</TabsTrigger>
4851
<TabsTrigger value="debonding">{t('common.debonding')}</TabsTrigger>
4952
</TabsList>
50-
<StyledCard
51-
sx={{
52-
borderTopRightRadius: 0,
53-
borderTopLeftRadius: 0,
54-
borderTop: 'none',
55-
}}
56-
>
53+
<StyledCard>
5754
<CardContent>
5855
{isLoading && <Skeleton className="h-[300px] mt-8" />}
5956
{!isLoading && account && (

src/app/pages/RuntimeAccountDetailsPage/ContractCodeCard.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ export const ContractCodeCard: FC<TokenDashboardContext> = ({ scope, address })
3030
.sort((a, b) => b.path.endsWith(entryFilePath) - a.path.endsWith(entryFilePath))
3131

3232
return (
33-
<Card>
33+
<Card
34+
sx={{
35+
borderTopRightRadius: 0,
36+
borderTopLeftRadius: 0,
37+
borderTop: 'none',
38+
}}
39+
>
3440
{noCode && <CardEmptyState label={t('contract.noCode')} />}
3541
{contract && (contract.creation_bytecode || contract.runtime_bytecode) && (
3642
<CardContent>

0 commit comments

Comments
 (0)