import { LevelExam, LevelPart, ReadingExam, ReadingPart } from "@/interfaces/exam";
import clsx from "clsx";
import { Fragment, useState } from "react";
import { BsChevronDown, BsChevronUp } from "react-icons/bs";
const TextComponent: React.FC<{ part: ReadingPart | LevelPart; exerciseType: string }> = ({ part, exerciseType }) => {
const numberToLetter = (number: number) => (number + 9).toString(36).toUpperCase();
return (
{part.text?.title}
{part.text?.content
.split(/\n|(\\n)/g)
.filter((x) => x && x.length > 0 && x !== "\\n")
.map((line, index) => (
{exerciseType === "matchSentences" && (
{numberToLetter(index + 1)}
{line}
)}
{exerciseType !== "matchSentences" && {line}
}
))}
);
}
interface Props {
exam: ReadingExam | LevelExam;
partIndex: number;
exerciseType: string;
isTextMinimized: boolean;
setIsTextMinimized: React.Dispatch>;
}
const ReadingPassage: React.FC = ({exam, partIndex, exerciseType, isTextMinimized, setIsTextMinimized}) => {
return (
{!isTextMinimized && (
<>
Please read the following excerpt attentively, you will then be asked questions about the text you've read.
You will be allowed to read the text while doing the exercises
>
)}
{isTextMinimized &&
Reading Passage}
);
};
export default ReadingPassage;