frontAnswerer/src/pages/ViewPublicationPage/questions/Page.tsx

59 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-12-16 14:55:56 +00:00
import { Box, Typography } from "@mui/material";
import { useQuizViewStore, updateAnswer } from "@root/quizView/store";
2023-12-16 14:55:56 +00:00
import type { QuizQuestionPage } from "../../../model/questionTypes/page";
type PageProps = {
currentQuestion: QuizQuestionPage;
};
export const Page = ({ currentQuestion }: PageProps) => {
const { answers } = useQuizViewStore();
const { answer } = answers.find(({ questionId }) => questionId === currentQuestion.id) ?? {};
2023-12-16 14:55:56 +00:00
return (
<Box>
<Typography variant="h5" sx={{ paddingBottom: "25px" }}>{currentQuestion.title}</Typography>
<Typography>{currentQuestion.content.text}</Typography>
<Box
sx={{
display: "flex",
flexDirection: "column",
width: "100%",
marginTop: "20px",
}}
>
{currentQuestion.content.picture && (
<Box sx={{borderRadius: "12px",
border: "1px solid #9A9AAF", overflow: "hidden" }}>
<img
src={currentQuestion.content.picture}
alt=""
style={{
display: "block",
width: "100%",
height: "100%",
objectFit: "contain",
}}
/>
</Box>
)}
{currentQuestion.content.video && (
<video
src={currentQuestion.content.video}
controls
style={{
width: "100%",
height: "100%",
maxHeight: "80vh",
objectFit: "contain",
}}
/>
)}
</Box>
</Box>
);
};