portainer/app/react/components/PageHeader/HeaderContainer.tsx

31 lines
794 B
TypeScript
Raw Normal View History

import { PropsWithChildren, createContext, useContext } from 'react';
2022-08-12 03:47:56 +00:00
import clsx from 'clsx';
2022-08-12 03:47:56 +00:00
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">
2022-08-12 03:47:56 +00:00
<div className={styles.meta}>{children}</div>
</div>
</div>
</Context.Provider>
);
}