Skip to content

styling: sync tab styling with Figma design #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/curve-common/src/widgets/Header/PageTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ export const PageTabs: FunctionComponent<PageTabsProps> = ({ pages, currentApp,
[currentApp, networkName, pages, selectedApp],
)}
variant="overlined"
textVariant="headingXsBold"
/>
)
16 changes: 14 additions & 2 deletions packages/curve-ui-kit/src/shared/ui/TabsSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import Tabs, { type TabsProps } from '@mui/material/Tabs'
import Tab, { type TabProps } from '@mui/material/Tab'
import { TabSwitcherVariants, TABS_VARIANT_CLASSES, TABS_HEIGHT_CLASSES } from '../../themes/tabs'
import Typography, { type TypographyProps } from '@mui/material/Typography'
import type { TypographyVariantKey } from '@ui-kit/themes/typography'

const defaultTextVariants = {
small: 'buttonS',
medium: 'buttonM',
large: 'headingMBold',
} as const satisfies Record<keyof typeof TABS_HEIGHT_CLASSES, TypographyVariantKey>

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

export const TabsSwitcher = <T extends string | number>({
variant = 'contained',
size = 'medium',
size = 'small',
muiVariant,
options,
onChange,
Expand All @@ -37,7 +44,12 @@ export const TabsSwitcher = <T extends string | number>({
{...props}
>
{options.map(({ value, label, ...props }) => (
<Tab key={value} value={value} label={<Typography variant={textVariant}>{label}</Typography>} {...props} />
<Tab
key={value}
value={value}
label={<Typography variant={textVariant ?? defaultTextVariants[size]}>{label}</Typography>}
{...props}
/>
))}
</Tabs>
)
2 changes: 1 addition & 1 deletion packages/curve-ui-kit/src/themes/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const createComponents = (design: DesignSystem, typography: TypographyOpt
},
},
},
MuiTab: defineMuiTab(),
MuiTab: defineMuiTab(design),
MuiTabs: defineMuiTabs(design),
MuiToolbar: {
styleOverrides: {
Expand Down
Loading
Loading