2024-02-08 13:42:31 +00:00
|
|
|
import { ReactNode } from "react";
|
2024-03-04 16:40:53 +00:00
|
|
|
import { Box, Typography, useTheme } from "@mui/material";
|
|
|
|
|
2024-05-31 17:56:17 +00:00
|
|
|
import { useQuizSettings } from "@contexts/QuizDataContext";
|
2024-03-04 16:40:53 +00:00
|
|
|
|
|
|
|
import Stepper from "@ui_kit/Stepper";
|
2025-04-20 15:16:22 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2023-12-16 14:55:56 +00:00
|
|
|
|
|
|
|
type FooterProps = {
|
2024-05-31 16:41:18 +00:00
|
|
|
stepNumber: number | null;
|
|
|
|
nextButton: ReactNode;
|
|
|
|
prevButton: ReactNode;
|
2023-12-16 14:55:56 +00:00
|
|
|
};
|
|
|
|
|
2024-02-08 13:42:31 +00:00
|
|
|
export const Footer = ({ stepNumber, nextButton, prevButton }: FooterProps) => {
|
2024-05-31 16:41:18 +00:00
|
|
|
const theme = useTheme();
|
2024-05-31 17:56:17 +00:00
|
|
|
const { questions, settings } = useQuizSettings();
|
2024-05-31 16:41:18 +00:00
|
|
|
const questionsAmount = questions.filter(({ type }) => type !== "result").length;
|
2025-04-20 15:16:22 +00:00
|
|
|
const { t } = useTranslation();
|
2024-01-30 16:49:33 +00:00
|
|
|
|
2024-05-31 16:41:18 +00:00
|
|
|
return (
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
position: "relative",
|
|
|
|
padding: "15px 0",
|
|
|
|
borderTop: `1px solid #9A9AAF80`,
|
|
|
|
height: "75px",
|
|
|
|
display: "flex",
|
|
|
|
background: settings.cfg.design ? "rgba(154,154,175, 0.2)" : "transparent",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<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 }}>
|
2025-04-20 15:16:22 +00:00
|
|
|
{t("Step")} {stepNumber} {t("of")} {questionsAmount}
|
2024-05-31 16:41:18 +00:00
|
|
|
</Typography>
|
2024-09-12 08:43:50 +00:00
|
|
|
<Stepper
|
|
|
|
activeStep={stepNumber}
|
|
|
|
steps={questionsAmount}
|
|
|
|
/>
|
2024-05-31 16:41:18 +00:00
|
|
|
</Box>
|
|
|
|
)}
|
|
|
|
{prevButton}
|
|
|
|
{nextButton}
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
);
|
2023-12-16 14:55:56 +00:00
|
|
|
};
|