2022-06-28 07:42:42 +00:00
|
|
|
import { ChevronsLeft, ChevronsRight } from 'react-feather';
|
|
|
|
|
|
|
|
import defaultLogo from '@/assets/images/logo_small_alt.png';
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
import { Link } from '@@/Link';
|
|
|
|
|
|
|
|
import { useSidebarState } from './useSidebarState';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
logo?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Header({ logo }: Props) {
|
2022-06-28 07:42:42 +00:00
|
|
|
const { toggle, isOpen } = useSidebarState();
|
2022-06-23 07:25:56 +00:00
|
|
|
|
|
|
|
return (
|
2022-06-28 07:42:42 +00:00
|
|
|
<div className="flex justify-between items-center">
|
|
|
|
<Link
|
|
|
|
to="portainer.home"
|
|
|
|
data-cy="portainerSidebar-homeImage"
|
2022-07-06 05:09:14 +00:00
|
|
|
className="text-2xl text-white no-underline hover:no-underline hover:text-white focus:no-underline focus:text-white focus:outline-none"
|
2022-06-28 07:42:42 +00:00
|
|
|
>
|
2022-06-23 07:25:56 +00:00
|
|
|
<img
|
|
|
|
src={logo || defaultLogo}
|
|
|
|
className="img-responsive logo"
|
2022-06-28 07:42:42 +00:00
|
|
|
alt={!logo ? 'portainer.io' : 'Logo'}
|
2022-06-23 07:25:56 +00:00
|
|
|
/>
|
2022-06-28 07:42:42 +00:00
|
|
|
{isOpen && 'portainer.io'}
|
2022-06-23 07:25:56 +00:00
|
|
|
</Link>
|
2022-06-28 07:42:42 +00:00
|
|
|
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
onClick={() => toggle()}
|
2022-07-06 05:09:14 +00:00
|
|
|
className="w-6 h-6 flex justify-center items-center text-gray-4 be:text-gray-5 border-0 rounded text-sm bg-blue-11 hover:bg-blue-10 be:bg-gray-10 be:hover:bg-gray-8 transition-colors duration-200 hover:text-white be:hover:text-white"
|
2022-06-28 07:42:42 +00:00
|
|
|
aria-label="Toggle Sidebar"
|
|
|
|
title="Toggle Sidebar"
|
|
|
|
>
|
|
|
|
{isOpen ? <ChevronsLeft /> : <ChevronsRight />}
|
|
|
|
</button>
|
2022-06-23 07:25:56 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|