Skip to content

Commit 49ee97e

Browse files
authored
Merge pull request #595 from curvefi/styling/tabs
styling: sync tab styling with Figma design
2 parents ae0cf3b + f7b9004 commit 49ee97e

File tree

6 files changed

+496
-333
lines changed

6 files changed

+496
-333
lines changed

packages/curve-common/src/widgets/Header/PageTabs.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ export const PageTabs: FunctionComponent<PageTabsProps> = ({ pages, currentApp,
3131
[currentApp, networkName, pages, selectedApp],
3232
)}
3333
variant="overlined"
34-
textVariant="headingXsBold"
3534
/>
3635
)

packages/curve-ui-kit/src/shared/ui/TabsSwitcher.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import Tabs, { type TabsProps } from '@mui/material/Tabs'
22
import Tab, { type TabProps } from '@mui/material/Tab'
33
import { TabSwitcherVariants, TABS_VARIANT_CLASSES, TABS_HEIGHT_CLASSES } from '../../themes/tabs'
44
import Typography, { type TypographyProps } from '@mui/material/Typography'
5+
import type { TypographyVariantKey } from '@ui-kit/themes/typography'
6+
7+
const defaultTextVariants = {
8+
small: 'buttonS',
9+
medium: 'buttonM',
10+
large: 'headingMBold',
11+
} as const satisfies Record<keyof typeof TABS_HEIGHT_CLASSES, TypographyVariantKey>
512

613
export type TabOption<T> = Pick<TabProps, 'label' | 'disabled' | 'icon' | 'sx'> & {
714
value: T
@@ -20,7 +27,7 @@ export type TabsSwitcherProps<T> = Pick<TabsProps, 'sx'> & {
2027

2128
export const TabsSwitcher = <T extends string | number>({
2229
variant = 'contained',
23-
size = 'medium',
30+
size = 'small',
2431
muiVariant,
2532
options,
2633
onChange,
@@ -37,7 +44,12 @@ export const TabsSwitcher = <T extends string | number>({
3744
{...props}
3845
>
3946
{options.map(({ value, label, ...props }) => (
40-
<Tab key={value} value={value} label={<Typography variant={textVariant}>{label}</Typography>} {...props} />
47+
<Tab
48+
key={value}
49+
value={value}
50+
label={<Typography variant={textVariant ?? defaultTextVariants[size]}>{label}</Typography>}
51+
{...props}
52+
/>
4153
))}
4254
</Tabs>
4355
)

packages/curve-ui-kit/src/themes/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const createComponents = (design: DesignSystem, typography: TypographyOpt
116116
},
117117
},
118118
},
119-
MuiTab: defineMuiTab(),
119+
MuiTab: defineMuiTab(design),
120120
MuiTabs: defineMuiTabs(design),
121121
MuiToolbar: {
122122
styleOverrides: {

0 commit comments

Comments
 (0)