1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-24 17:51:14 +02:00
unleash.unleash/frontend/src/component/common/VerticalTabs/VerticalTab/VerticalTab.tsx
Nuno Góis 4167a60588
feat: biome lint frontend (#4903)
Follows up on https://github.com/Unleash/unleash/pull/4853 to add Biome
to the frontend as well.


![image](https://github.com/Unleash/unleash/assets/14320932/1906faf1-fc29-4172-a4d4-b2716d72cd65)

Added a few `biome-ignore` to speed up the process but we may want to
check and fix them in the future.
2023-10-02 13:25:46 +01:00

68 lines
1.8 KiB
TypeScript

import { Button, styled } from '@mui/material';
const StyledTab = styled(Button)<{ selected: boolean }>(
({ theme, selected }) => ({
'&.MuiButton-root': {
cursor: 'pointer',
height: theme.spacing(6.5),
border: 0,
backgroundColor: selected
? theme.palette.background.paper
: 'transparent',
borderLeft: `${theme.spacing(1)} solid ${
selected ? theme.palette.background.alternative : 'transparent'
}`,
borderRadius: theme.shape.borderRadiusMedium,
justifyContent: 'start',
transition: 'background-color 0.2s ease',
color: theme.palette.text.primary,
textAlign: 'left',
padding: theme.spacing(2, 4),
fontSize: theme.fontSizes.bodySize,
fontWeight: selected
? theme.fontWeight.bold
: theme.fontWeight.medium,
lineHeight: 1.2,
},
'&:hover': {
backgroundColor: theme.palette.neutral.light,
},
'&.Mui-disabled': {
pointerEvents: 'auto',
},
'&:focus-visible': {
outline: `2px solid ${theme.palette.primary.main}`,
},
justifyContent: 'space-between',
'& > span': {
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
},
}),
);
interface IVerticalTabProps {
label: string;
selected?: boolean;
onClick: () => void;
icon?: React.ReactNode;
}
export const VerticalTab = ({
label,
selected,
onClick,
icon,
}: IVerticalTabProps) => (
<StyledTab
selected={Boolean(selected)}
onClick={onClick}
disableElevation
disableFocusRipple
fullWidth
>
{label}
{icon}
</StyledTab>
);