mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-18 11:14:57 +02:00
Follows up on https://github.com/Unleash/unleash/pull/4853 to add Biome to the frontend as well.  Added a few `biome-ignore` to speed up the process but we may want to check and fix them in the future.
67 lines
1.5 KiB
TypeScript
67 lines
1.5 KiB
TypeScript
import { styled } from '@mui/material';
|
|
import { VerticalTab } from './VerticalTab/VerticalTab';
|
|
|
|
const StyledTabPage = styled('div')(({ theme }) => ({
|
|
display: 'flex',
|
|
gap: theme.spacing(3),
|
|
[theme.breakpoints.down('md')]: {
|
|
flexDirection: 'column',
|
|
},
|
|
}));
|
|
|
|
const StyledTabPageContent = styled('div')(() => ({
|
|
flexGrow: 1,
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
}));
|
|
|
|
const StyledTabs = styled('div')(({ theme }) => ({
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
gap: theme.spacing(1),
|
|
width: theme.spacing(30),
|
|
flexShrink: 0,
|
|
[theme.breakpoints.down('md')]: {
|
|
width: '100%',
|
|
},
|
|
}));
|
|
|
|
export interface ITab {
|
|
id: string;
|
|
label: string;
|
|
path?: string;
|
|
hidden?: boolean;
|
|
icon?: React.ReactNode;
|
|
}
|
|
|
|
interface IVerticalTabsProps {
|
|
tabs: ITab[];
|
|
value: string;
|
|
onChange: (tab: ITab) => void;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export const VerticalTabs = ({
|
|
tabs,
|
|
value,
|
|
onChange,
|
|
children,
|
|
}: IVerticalTabsProps) => (
|
|
<StyledTabPage>
|
|
<StyledTabs>
|
|
{tabs
|
|
.filter((tab) => !tab.hidden)
|
|
.map((tab) => (
|
|
<VerticalTab
|
|
key={tab.id}
|
|
label={tab.label}
|
|
selected={tab.id === value}
|
|
onClick={() => onChange(tab)}
|
|
icon={tab.icon}
|
|
/>
|
|
))}
|
|
</StyledTabs>
|
|
<StyledTabPageContent>{children}</StyledTabPageContent>
|
|
</StyledTabPage>
|
|
);
|