1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-20 13:59:40 +02:00
portainer/app/react/components/PageHeader/HeaderContainer.tsx
fhanportainer c17baa36ef
fix(app-template): fixed the app template list not scroll to top issue (#7519)
* fix(app-template): fixed the app template list not scroll to top issue

* fix(templates): added id prop to PageHeader component.
2022-08-20 00:31:17 +12:00

30 lines
794 B
TypeScript

import { PropsWithChildren, createContext, useContext } from 'react';
import clsx from 'clsx';
import styles from './HeaderContainer.module.css';
const Context = createContext<null | boolean>(null);
export function useHeaderContext() {
const context = useContext(Context);
if (context == null) {
throw new Error('Should be nested inside a HeaderContainer component');
}
}
interface Props {
id?: string;
}
export function HeaderContainer({ id, children }: PropsWithChildren<Props>) {
return (
<Context.Provider value>
<div id={id} className={clsx('row', styles.header)}>
<div id="loadingbar-placeholder" />
<div className="col-xs-12">
<div className={styles.meta}>{children}</div>
</div>
</div>
</Context.Provider>
);
}