frontPanel/src/pages/createQuize/CreateButtons.tsx

65 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Link, useNavigate } from "react-router-dom";
import { Box, Button, Typography, useMediaQuery, useTheme } from "@mui/material";
import { ReactComponent as TemplateIcon } from "@/assets/quiz-templates/template.svg";
import { createQuiz, resetEditConfig } from "@root/quizes/actions";
import React from "react";
import { useUserStore } from "@/stores/user";
export default function CreateButtons({ mt }: string) {
const navigate = useNavigate();
const theme = useTheme();
const user = useUserStore();
const isMobile = useMediaQuery(theme.breakpoints.down(500));
return (
<Box
sx={{
display: "flex",
gap: "20px",
flexWrap: "wrap",
marginTop: mt,
}}
>
{
user?.user?._id === "6692e068983ee77f8e1e682e" &&
<Link to="/gallery" style={{ textDecoration: "none" }}>
<Button
sx={{
display: "flex",
gap: "10px",
padding: "13px",
borderRadius: "8px",
background: "#9A9AAF17",
color: theme.palette.brightPurple.main,
transition: ".2s",
"&:hover": {
color: theme.palette.background.paper,
background: theme.palette.brightPurple.main,
"& svg path": { stroke: theme.palette.background.paper },
},
}}
>
<TemplateIcon />
{!isMobile && <Typography>Посмотреть шаблоны</Typography>}
</Button>
</Link>
}
<Button
variant="contained"
sx={{
padding: isMobile ? "10px" : "10px 47px",
minWidth: "44px",
}}
onClick={() => {
resetEditConfig();
createQuiz(navigate);
}}
data-cy="create-quiz"
>
{isMobile ? "+" : "Создать +"}
</Button>
</Box>
)
}