Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1x 1x 1x 1x 1x 1x 1x 23x 11x 23x 23x 23x 9x 3x | import { darken, styled, Typography, useMediaQuery } from "@mui/material";
import Button from "components/Button";
import { BugIcon } from "components/Icons";
import { useTranslation } from "i18n";
import { useState } from "react";
import { theme } from "theme";
import ReportDialog from "./ReportDialog";
const StyledReportButton = styled(Button)(() => ({
flexShrink: 0,
backgroundColor: theme.palette.error.main,
"&:hover": {
backgroundColor: darken(theme.palette.error.main, 0.1),
},
"& .MuiButton-startIcon": {
[theme.breakpoints.down("md")]: {
margin: 0,
},
},
}));
export default function ReportButton({
isResponsive = true,
isMenuLink,
}: {
isResponsive?: boolean;
isMenuLink?: boolean;
}) {
const { t } = useTranslation("global");
const isBelowMd = useMediaQuery(theme.breakpoints.down("md"));
const [isDialogOpen, setIsDialogOpen] = useState(false);
return (
<>
{isMenuLink ? (
<Typography
aria-label={t("report.label")}
onClick={() => setIsDialogOpen(true)}
sx={{
color: theme.palette.text.secondary,
cursor: "pointer",
"&:hover": {
textDecoration: "underline",
},
}}
>
{t("report.label")}
</Typography>
) : (
<StyledReportButton
aria-label={t("report.label")}
onClick={() => setIsDialogOpen(true)}
startIcon={<BugIcon />}
variant="contained"
color="primary"
>
{(!isResponsive || !isBelowMd) && t("report.label")}
</StyledReportButton>
)}
<ReportDialog
open={isDialogOpen}
onClose={() => setIsDialogOpen(false)}
/>
</>
);
}
|