add label prop
This commit is contained in:
1 parent
c352ca39b1
commit
dec12cc6ab
1 file changed
+8
-2
@@ -3,7 +3,12 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import SkeletonLayout from "./skeleton";
|
import SkeletonLayout from "./skeleton";
|
||||||
|
|
||||||
const CreateMonitorHeader = ({ isAdmin, shouldRender = true, path }) => {
|
const CreateMonitorHeader = ({
|
||||||
|
isAdmin,
|
||||||
|
label = "Create new",
|
||||||
|
shouldRender = true,
|
||||||
|
path,
|
||||||
|
}) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
if (!isAdmin) return null;
|
if (!isAdmin) return null;
|
||||||
if (!shouldRender) return <SkeletonLayout />;
|
if (!shouldRender) return <SkeletonLayout />;
|
||||||
@@ -18,7 +23,7 @@ const CreateMonitorHeader = ({ isAdmin, shouldRender = true, path }) => {
|
|||||||
color="accent"
|
color="accent"
|
||||||
onClick={() => navigate(path)}
|
onClick={() => navigate(path)}
|
||||||
>
|
>
|
||||||
Create new
|
{label}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
@@ -30,4 +35,5 @@ CreateMonitorHeader.propTypes = {
|
|||||||
isAdmin: PropTypes.bool.isRequired,
|
isAdmin: PropTypes.bool.isRequired,
|
||||||
shouldRender: PropTypes.bool,
|
shouldRender: PropTypes.bool,
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
|
label: PropTypes.string,
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user