Added the ability to read the text on Reading exercises
This commit is contained in:
@@ -48,12 +48,12 @@ function TextModal({isOpen, title, content, onClose}: {isOpen: boolean; title: s
|
|||||||
leave="ease-in duration-200"
|
leave="ease-in duration-200"
|
||||||
leaveFrom="opacity-100 scale-100"
|
leaveFrom="opacity-100 scale-100"
|
||||||
leaveTo="opacity-0 scale-95">
|
leaveTo="opacity-0 scale-95">
|
||||||
<Dialog.Panel className="w-full max-w-4xl transform rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
|
<Dialog.Panel className="w-full relative max-w-4xl transform rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
|
||||||
<Dialog.Title as="h3" className="text-lg font-medium leading-6 text-gray-900">
|
<Dialog.Title as="h3" className="text-lg font-medium leading-6 text-gray-900">
|
||||||
{title}
|
{title}
|
||||||
</Dialog.Title>
|
</Dialog.Title>
|
||||||
<div className="mt-2 overflow-auto">
|
<div className="mt-2 overflow-auto mb-28">
|
||||||
<p className="text-sm text-gray-500">
|
<p className="text-sm">
|
||||||
{content.split("\\n").map((line, index) => (
|
{content.split("\\n").map((line, index) => (
|
||||||
<Fragment key={index}>
|
<Fragment key={index}>
|
||||||
{line}
|
{line}
|
||||||
@@ -63,13 +63,10 @@ function TextModal({isOpen, title, content, onClose}: {isOpen: boolean; title: s
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-4">
|
<div className="absolute bottom-8 right-8 max-w-[200px] self-end w-full">
|
||||||
<button
|
<Button color="green" variant="outline" className="max-w-[200px] self-end w-full" onClick={onClose}>
|
||||||
type="button"
|
Close
|
||||||
className="inline-flex justify-center rounded-md border border-transparent bg-blue-100 px-4 py-2 text-sm font-medium text-blue-900 hover:bg-blue-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
|
</Button>
|
||||||
onClick={onClose}>
|
|
||||||
Got it, thanks!
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</Dialog.Panel>
|
</Dialog.Panel>
|
||||||
</Transition.Child>
|
</Transition.Child>
|
||||||
@@ -177,6 +174,15 @@ export default function Reading({exam, showSolutions = false, onFinish}: Props)
|
|||||||
exerciseIndex < exam.exercises.length &&
|
exerciseIndex < exam.exercises.length &&
|
||||||
showSolutions &&
|
showSolutions &&
|
||||||
renderSolution(exam.exercises[exerciseIndex], nextExercise, previousExercise)}
|
renderSolution(exam.exercises[exerciseIndex], nextExercise, previousExercise)}
|
||||||
|
{exerciseIndex > -1 && exerciseIndex < exam.exercises.length && (
|
||||||
|
<Button
|
||||||
|
color="green"
|
||||||
|
variant="outline"
|
||||||
|
onClick={() => setShowTextModal(true)}
|
||||||
|
className="max-w-[200px] self-end w-full absolute bottom-[31px] right-64">
|
||||||
|
Read text
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{exerciseIndex === -1 && (
|
{exerciseIndex === -1 && (
|
||||||
<Button color="green" onClick={() => nextExercise()} className="max-w-[200px] self-end w-full">
|
<Button color="green" onClick={() => nextExercise()} className="max-w-[200px] self-end w-full">
|
||||||
|
|||||||
Reference in New Issue
Block a user