34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
"use client";
|
|
|
|
import { Button, IconButton, useMediaQuery } from "@mui/material";
|
|
import { useTheme } from "@emotion/react";
|
|
import { useState } from "react";
|
|
import { AddCircle } from "@mui/icons-material";
|
|
import CandUAzmayesh from "@/components/dashboard/azmayesh/Forms/CandUAzmayesh";
|
|
|
|
const AzmayeshCreate = ({ mutate }) => {
|
|
const theme = useTheme();
|
|
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
const [open, setOpen] = useState(false);
|
|
|
|
const handleOpen = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
{isMobile ? (
|
|
<IconButton aria-label="ثبت آزمایش جدید" color="primary" onClick={handleOpen}>
|
|
<AddCircle sx={{ fontSize: "25px" }} />
|
|
</IconButton>
|
|
) : (
|
|
<Button variant="contained" color="primary" startIcon={<AddCircle />} onClick={handleOpen}>
|
|
ثبت آزمایش
|
|
</Button>
|
|
)}
|
|
{open && <CandUAzmayesh open={open} setOpen={setOpen} mutate={mutate} />}
|
|
</>
|
|
);
|
|
};
|
|
export default AzmayeshCreate;
|