diff --git a/.changelog/2122.internal.md b/.changelog/2122.internal.md new file mode 100644 index 0000000000..f6d624252d --- /dev/null +++ b/.changelog/2122.internal.md @@ -0,0 +1 @@ +Remove usage of MUI Tabs component diff --git a/src/app/components/DurationPills/index.tsx b/src/app/components/DurationPills/index.tsx index e0ec539e6d..85382fd8f5 100644 --- a/src/app/components/DurationPills/index.tsx +++ b/src/app/components/DurationPills/index.tsx @@ -1,19 +1,7 @@ import { FC } from 'react' import { useTranslation } from 'react-i18next' -import { styled } from '@mui/material/styles' -import Box from '@mui/material/Box' -import Chip from '@mui/material/Chip' -import Typography from '@mui/material/Typography' import { ChartDuration } from '../../utils/chart-utils' -import { COLORS } from '../../../styles/theme/colors' - -export const StyledBox = styled(Box)(({ theme }) => ({ - backgroundColor: COLORS.brandDark, - width: 14, - height: 14, - marginRight: theme.spacing(3), - borderRadius: 4, -})) +import { Tabs, TabsList, TabsTrigger } from '@oasisprotocol/ui-library/src/components/tabs' type DurationPillsProps = { handleChange: (duration: ChartDuration) => void @@ -38,25 +26,15 @@ export const DurationPills: FC = ({ handleChange, value }) = ] return ( - <> - {options.map(option => ( - handleChange(option.value)} - clickable - color="secondary" - label={ - - - - {option.label} - - - } - sx={{ mr: 2 }} - variant={value === option.value ? 'outlined-selected' : 'outlined'} - /> - ))} - + // Mobile margin prevents overflow Recharts + + + {options.map(option => ( + handleChange(option.value)}> + {option.label} + + ))} + + ) } diff --git a/src/app/components/FilterButtons/index.tsx b/src/app/components/FilterButtons/index.tsx index d0ed2269ed..f187ea387a 100644 --- a/src/app/components/FilterButtons/index.tsx +++ b/src/app/components/FilterButtons/index.tsx @@ -1,7 +1,4 @@ -import Box from '@mui/material/Box' -import Chip from '@mui/material/Chip' -import CheckIcon from '@mui/icons-material/Check' -import { COLORS } from '../../../styles/theme/colors' +import { Tabs, TabsList, TabsTrigger } from '@oasisprotocol/ui-library/src/components/tabs' type FilterButtonsProps = { options: { label: string; value: T }[] @@ -11,27 +8,14 @@ type FilterButtonsProps = { export const FilterButtons = ({ options, onSelect, value }: FilterButtonsProps) => { return ( - - {options.map(option => { - const selected = option.value === value - return ( - onSelect(option.value)} - clickable - color="secondary" - icon={selected ? : undefined} - label={option.label} - sx={{ - mr: 3, - borderColor: COLORS.brandMedium, - backgroundColor: selected ? COLORS.brandMedium : COLORS.brandMedium15, - color: selected ? COLORS.white : COLORS.grayExtraDark, - }} - variant={selected ? 'outlined-selected' : 'outlined'} - /> - ) - })} - + + + {options.map(option => ( + onSelect(option.value)}> + {option.label} + + ))} + + ) } diff --git a/src/app/components/LinkableCardLayout/index.tsx b/src/app/components/LinkableCardLayout/index.tsx index 767edafccf..88afdfe8c0 100644 --- a/src/app/components/LinkableCardLayout/index.tsx +++ b/src/app/components/LinkableCardLayout/index.tsx @@ -13,7 +13,13 @@ type LinkableCardLayoutProps = { } export const LinkableCardLayout: FC = ({ children, containerId, title, action }) => { return ( - + diff --git a/src/app/components/RouterTabs/index.tsx b/src/app/components/RouterTabs/index.tsx index 657d687593..0369d53567 100644 --- a/src/app/components/RouterTabs/index.tsx +++ b/src/app/components/RouterTabs/index.tsx @@ -1,7 +1,6 @@ import { useLocation, Outlet, useMatches } from 'react-router-dom' import { NonScrollingRouterLink } from '../NonScrollingRouterLink' -import Tabs from '@mui/material/Tabs' -import Tab from '@mui/material/Tab' +import { Tabs, TabsList, TabsTrigger } from '@oasisprotocol/ui-library/src/components/tabs' type RouterTabsProps = { tabs: { @@ -29,18 +28,18 @@ export function RouterTabs({ tabs, context }: RouterTabsProps) return ( <> - - {tabs - .filter(tab => tab === targetTab || tab.visible !== false) - .map(tab => ( - - ))} + + + {tabs + .filter(tab => tab === targetTab || tab.visible !== false) + .map(tab => ( + + + {tab.label} + + + ))} + diff --git a/src/app/pages/ConsensusAccountDetailsPage/Staking.tsx b/src/app/pages/ConsensusAccountDetailsPage/Staking.tsx index 66f72e45c5..1bd6ab73da 100644 --- a/src/app/pages/ConsensusAccountDetailsPage/Staking.tsx +++ b/src/app/pages/ConsensusAccountDetailsPage/Staking.tsx @@ -1,12 +1,10 @@ -import { FC, useState } from 'react' +import { FC } from 'react' import { useTranslation } from 'react-i18next' -import Box from '@mui/material/Box' import Card from '@mui/material/Card' import CardContent from '@mui/material/CardContent' import Link from '@mui/material/Link' import { Skeleton } from '@oasisprotocol/ui-library/src/components/ui/skeleton' -import Tabs from '@mui/material/Tabs' -import Tab from '@mui/material/Tab' +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@oasisprotocol/ui-library/src/components/tabs' import { styled } from '@mui/material/styles' import { Account, @@ -25,6 +23,9 @@ import { tableCellClasses } from '@mui/material/TableCell' export const StyledCard = styled(Card)(({ theme }) => ({ flex: 1, + borderTopRightRadius: 0, + borderTopLeftRadius: 0, + borderTop: 'none', '&': { padding: `0 ${theme.spacing(4)}`, marginBottom: 0, @@ -41,22 +42,31 @@ type StakingProps = { export const Staking: FC = ({ account, isLoading }) => { const { t } = useTranslation() - const [tab, setTabValue] = useState(0) return ( - - setTabValue(tab)} aria-label={t('validator.delegations')}> - - +
+ + + {t('common.staked')} + {t('common.debonding')} + + + + {isLoading && } + {!isLoading && account && ( + <> + + + + + + + + )} + + - - - {isLoading && } - {account && tab === 0 && } - {account && tab === 1 && } - - - +
) } diff --git a/src/app/pages/RuntimeAccountDetailsPage/ContractCodeCard.tsx b/src/app/pages/RuntimeAccountDetailsPage/ContractCodeCard.tsx index ac38af8689..8b56f16197 100644 --- a/src/app/pages/RuntimeAccountDetailsPage/ContractCodeCard.tsx +++ b/src/app/pages/RuntimeAccountDetailsPage/ContractCodeCard.tsx @@ -30,7 +30,13 @@ export const ContractCodeCard: FC = ({ scope, address }) .sort((a, b) => b.path.endsWith(entryFilePath) - a.path.endsWith(entryFilePath)) return ( - + {noCode && } {contract && (contract.creation_bytecode || contract.runtime_bytecode) && ( diff --git a/ui-library b/ui-library index 8562326768..d310cb30ae 160000 --- a/ui-library +++ b/ui-library @@ -1 +1 @@ -Subproject commit 856232676828081ba9a806d9d9646b4f41668112 +Subproject commit d310cb30aea6cb4709495bd7e3ed9b8cf4881a30