1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-28 17:55:15 +02:00
unleash.unleash/frontend/src/component/common/VerticalTabs/VerticalTabs.tsx
Nuno Góis ddcfe132e4
feat: new profile page and PATs front-end (#2109)
* feat: new user dropdown and profile page

* fix: add popup boxShadow to dark-theme

* fix: update routes snap

* refactor: move some tab specific logic into tabs component

* add useProfile hook example

* fix profile tab header (no name)

* fix: hide user popup when clicking profile link

* - add PATs to profile;
- add route logic to profile;
- refactor TimeAgoCell title;
- misc fixes and refactoring;

* add profile info to profile tab

* simplify req paths

* add PAT flag to the front-end

* fix: some UI adjustments

* change user popup buttons to links

* fix profile on front-end, add role description

* update delete PAT text

* address some PR comments

* address PR comments

* some more UI fixes and refactoring

* move password request to API hook
2022-10-03 10:49:52 +01:00

65 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;
}
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)}
/>
))}
</StyledTabs>
<StyledTabPageContent>{children}</StyledTabPageContent>
</StyledTabPage>
);