quivr/frontend/lib/components/PageHeader/PageHeader.tsx
Antoine Dewez a540a201e3
feat(frontend): Page Header + Begin of Studio (#2151)
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
2024-02-06 16:05:07 -08:00

43 lines
1.0 KiB
TypeScript

import { useMenuContext } from "@/lib/context/MenuProvider/hooks/useMenuContext";
import { ButtonType } from "@/lib/types/QuivrButton";
import styles from "./PageHeader.module.scss";
import { Icon } from "../ui/Icon/Icon";
import { QuivrButton } from "../ui/QuivrButton/QuivrButton";
type Props = {
iconName: string;
label: string;
buttons: ButtonType[];
};
export const PageHeader = ({
iconName,
label,
buttons,
}: Props): JSX.Element => {
const { isOpened } = useMenuContext();
return (
<div className={styles.page_header_wrapper}>
<div className={`${styles.left} ${!isOpened ? styles.menu_closed : ""}`}>
<Icon name={iconName} size="large" color="primary" />
<span>{label}</span>
</div>
<div className={styles.buttons_wrapper}>
{buttons.map((button, index) => (
<QuivrButton
key={index}
label={button.label}
onClick={button.onClick}
color={button.color}
/>
))}
</div>
</div>
);
};
export default PageHeader;