1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

feat(sidebar): implement new design [EE-3447] (#7118)

This commit is contained in:
Chaim Lev-Ari 2022-06-28 10:42:42 +03:00 committed by GitHub
parent e5e57978af
commit ed8f9b5931
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 1928 additions and 857 deletions

View file

@ -1,8 +1,9 @@
import defaultLogo from '@/assets/images/logo.png';
import { ChevronsLeft, ChevronsRight } from 'react-feather';
import defaultLogo from '@/assets/images/logo_small_alt.png';
import { Link } from '@@/Link';
import styles from './Header.module.css';
import { useSidebarState } from './useSidebarState';
interface Props {
@ -10,28 +11,32 @@ interface Props {
}
export function Header({ logo }: Props) {
const { toggle } = useSidebarState();
const { toggle, isOpen } = useSidebarState();
return (
<div className={styles.root}>
<Link to="portainer.home" data-cy="portainerSidebar-homeImage">
<div className="flex justify-between items-center">
<Link
to="portainer.home"
data-cy="portainerSidebar-homeImage"
className="text-2xl text-white no-underline hover:no-underline hover:text-white"
>
<img
src={logo || defaultLogo}
className="img-responsive logo"
alt={!logo ? 'Portainer' : ''}
alt={!logo ? 'portainer.io' : 'Logo'}
/>
{isOpen && 'portainer.io'}
</Link>
{toggle && (
<button
type="button"
onClick={() => toggle()}
className={styles.toggleButton}
aria-label="Toggle Sidebar"
title="Toggle Sidebar"
>
<i className="glyphicon glyphicon-transfer" />
</button>
)}
<button
type="button"
onClick={() => toggle()}
className="w-6 h-6 flex justify-center items-center text-gray-4 be:text-gray-5 border-0 rounded text-sm be:bg-gray-10 bg-blue-11 hover:text-white be:hover:text-white"
aria-label="Toggle Sidebar"
title="Toggle Sidebar"
>
{isOpen ? <ChevronsLeft /> : <ChevronsRight />}
</button>
</div>
);
}