frontAnswerer/lib/components/ViewPublicationPage/Footer.tsx

59 lines
1.8 KiB
TypeScript
Raw Normal View History

import { ReactNode } from "react";
2024-03-04 16:40:53 +00:00
import { Box, Typography, useTheme } from "@mui/material";
import { useQuizData } from "@contexts/QuizDataContext";
import Stepper from "@ui_kit/Stepper";
2023-12-16 14:55:56 +00:00
type FooterProps = {
2024-04-11 14:11:43 +00:00
stepNumber: number | null;
nextButton: ReactNode;
prevButton: ReactNode;
2023-12-16 14:55:56 +00:00
};
export const Footer = ({ stepNumber, nextButton, prevButton }: FooterProps) => {
2024-04-11 14:11:43 +00:00
const theme = useTheme();
const { questions, settings } = useQuizData();
const questionsAmount = questions.filter(
({ type }) => type !== "result"
).length;
2024-04-11 14:11:43 +00:00
return (
2024-02-29 14:07:09 +00:00
<Box
2023-12-29 00:58:19 +00:00
sx={{
2024-04-11 14:11:43 +00:00
position: "relative",
padding: "15px 0",
borderTop: `1px solid #9A9AAF80`,
height: "75px",
display: "flex",
background: settings.cfg.design
? "rgba(154,154,175, 0.2)"
: "transparent",
2023-12-29 00:58:19 +00:00
}}
2024-04-11 14:11:43 +00:00
>
<Box
sx={{
width: "100%",
maxWidth: "1410px",
padding: "10px",
margin: "0 auto",
display: "flex",
alignItems: "center",
gap: "10px",
}}
>
{stepNumber !== null && (
<Box sx={{ flexGrow: 1 }}>
<Typography sx={{ color: theme.palette.text.primary }}>
Вопрос {stepNumber} из {questionsAmount}
</Typography>
<Stepper activeStep={stepNumber} steps={questionsAmount} />
</Box>
)}
{prevButton}
{nextButton}
</Box>
2023-12-16 14:55:56 +00:00
</Box>
2024-04-11 14:11:43 +00:00
);
2023-12-16 14:55:56 +00:00
};