header create

This commit is contained in:
Alex Holliday committed 2026-01-24 16:19:43 +00:00
1 parent d877ecf061
commit b852293447
4 files changed
+47 -12

No files matched your search

@@ -1,14 +1,27 @@
import { Stack } from "@mui/material";
import { useNavigate } from "react-router-dom";
import { ButtonInput } from "../../inputs/Button";
import { useTranslation } from "react-i18next";
interface HeaderCreateProps {
label?: string;
path: string;
isLoading?: boolean;
isAdmin?: boolean;
}
export const HeaderCreate = ({ label = "Create", path }: HeaderCreateProps) => {
export const HeaderCreate = ({
label,
path,
isLoading = false,
isAdmin = false,
}: HeaderCreateProps) => {
const navigate = useNavigate();
const { t } = useTranslation();
if (!isAdmin) {
return null;
}
const handleClick = () => {
navigate(path);
@@ -25,8 +38,9 @@ export const HeaderCreate = ({ label = "Create", path }: HeaderCreateProps) => {
variant="contained"
color="primary"
onClick={handleClick}
loading={isLoading}
>
{label}
{label || t("common.buttons.create")}
</ButtonInput>
</Stack>
);