Skip to content

Commit 0293da4

Browse files
committed
Use new tabs in DurationPills component
1 parent fd5b312 commit 0293da4

1 file changed

Lines changed: 11 additions & 33 deletions

File tree

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
import { FC } from 'react'
22
import { useTranslation } from 'react-i18next'
3-
import { styled } from '@mui/material/styles'
4-
import Box from '@mui/material/Box'
5-
import Chip from '@mui/material/Chip'
6-
import Typography from '@mui/material/Typography'
73
import { ChartDuration } from '../../utils/chart-utils'
8-
import { COLORS } from '../../../styles/theme/colors'
9-
10-
export const StyledBox = styled(Box)(({ theme }) => ({
11-
backgroundColor: COLORS.brandDark,
12-
width: 14,
13-
height: 14,
14-
marginRight: theme.spacing(3),
15-
borderRadius: 4,
16-
}))
4+
import { Tabs, TabsList, TabsTrigger } from '@oasisprotocol/ui-library/src/components/tabs'
175

186
type DurationPillsProps = {
197
handleChange: (duration: ChartDuration) => void
@@ -38,25 +26,15 @@ export const DurationPills: FC<DurationPillsProps> = ({ handleChange, value }) =
3826
]
3927

4028
return (
41-
<>
42-
{options.map(option => (
43-
<Chip
44-
key={option.value}
45-
onClick={() => handleChange(option.value)}
46-
clickable
47-
color="secondary"
48-
label={
49-
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
50-
<StyledBox />
51-
<Typography component="span" sx={{ fontSize: 12 }}>
52-
{option.label}
53-
</Typography>
54-
</Box>
55-
}
56-
sx={{ mr: 2 }}
57-
variant={value === option.value ? 'outlined-selected' : 'outlined'}
58-
/>
59-
))}
60-
</>
29+
// Mobile margin prevents overflow Recharts
30+
<Tabs defaultValue={value} className="my-2 lg:my-0">
31+
<TabsList className="ml-auto w-full lg:w-auto">
32+
{options.map(option => (
33+
<TabsTrigger key={option.value} value={option.value} onClick={() => handleChange(option.value)}>
34+
{option.label}
35+
</TabsTrigger>
36+
))}
37+
</TabsList>
38+
</Tabs>
6139
)
6240
}

0 commit comments

Comments
 (0)