generated from muhtadeetaron/nextjs-template
fix(ui): fix exam screen layout, bottom navigation tabs
This commit is contained in:
@ -21,7 +21,7 @@ export default function TabsLayout({ children }: { children: ReactNode }) {
|
|||||||
<div className="min-h-screen flex flex-col">
|
<div className="min-h-screen flex flex-col">
|
||||||
<main className="flex-1">{children}</main>
|
<main className="flex-1">{children}</main>
|
||||||
|
|
||||||
<nav className="h-[70px] flex justify-around items-center border-t border-t-neutral-400 p-4 rounded-t-4xl bg-white">
|
<nav className="h-[70px] w-full flex justify-around items-center border-t border-t-neutral-400 p-4 rounded-t-4xl bg-white fixed bottom-0">
|
||||||
{tabs.map((tab) => (
|
{tabs.map((tab) => (
|
||||||
<Link
|
<Link
|
||||||
key={tab.name}
|
key={tab.name}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { useParams, useRouter, useSearchParams } from "next/navigation";
|
|||||||
import React, { useEffect, useState, useCallback, useReducer } from "react";
|
import React, { useEffect, useState, useCallback, useReducer } from "react";
|
||||||
import { useTimer } from "@/context/TimerContext";
|
import { useTimer } from "@/context/TimerContext";
|
||||||
import { API_URL, getToken } from "@/lib/auth";
|
import { API_URL, getToken } from "@/lib/auth";
|
||||||
|
import Header from "@/components/Header";
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
interface Question {
|
interface Question {
|
||||||
@ -31,22 +32,22 @@ interface AnswerAction {
|
|||||||
// Components
|
// Components
|
||||||
const QuestionItem = React.memo<QuestionItemProps>(
|
const QuestionItem = React.memo<QuestionItemProps>(
|
||||||
({ question, selectedAnswer, handleSelect }) => (
|
({ question, selectedAnswer, handleSelect }) => (
|
||||||
<div className="question-container">
|
<div className="border border-[#8abdff]/50 rounded-2xl p-4">
|
||||||
<h3 className="question-text">
|
<h3 className="text-xl font-medium mb-[20px]">
|
||||||
{question.id}. {question.question}
|
{question.id}. {question.question}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="options-container">
|
<div className="flex flex-col gap-4 items-start">
|
||||||
{Object.entries(question.options).map(([key, value]) => (
|
{Object.entries(question.options).map(([key, value]) => (
|
||||||
<button
|
<button
|
||||||
key={key}
|
key={key}
|
||||||
className={`option-button ${
|
className="flex items-center gap-3"
|
||||||
selectedAnswer === key ? "selected-option" : ""
|
|
||||||
}`}
|
|
||||||
onClick={() => handleSelect(question.id, key)}
|
onClick={() => handleSelect(question.id, key)}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className={`option-text ${
|
className={`flex items-center rounded-full border px-1.5 ${
|
||||||
selectedAnswer === key ? "selected-option-text" : ""
|
selectedAnswer === key
|
||||||
|
? "text-white bg-[#113768] border-[#113768]"
|
||||||
|
: ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{key.toUpperCase()}
|
{key.toUpperCase()}
|
||||||
@ -196,13 +197,20 @@ export default function ExamPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gray-50">
|
<div className="min-h-screen bg-gray-50">
|
||||||
|
<Header
|
||||||
|
examDuration={time}
|
||||||
|
displayTabTitle={null}
|
||||||
|
image={undefined}
|
||||||
|
displayUser={undefined}
|
||||||
|
displaySubject={undefined}
|
||||||
|
/>
|
||||||
<div className="container mx-auto px-4 py-8">
|
<div className="container mx-auto px-4 py-8">
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="flex items-center justify-center min-h-64">
|
<div className="flex items-center justify-center min-h-64">
|
||||||
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-900"></div>
|
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-900"></div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6 mb-20">
|
||||||
{questions?.map((question) => (
|
{questions?.map((question) => (
|
||||||
<QuestionItem
|
<QuestionItem
|
||||||
key={question.id}
|
key={question.id}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ export default function PretestPage() {
|
|||||||
return (
|
return (
|
||||||
<BackgroundWrapper>
|
<BackgroundWrapper>
|
||||||
<div className="min-h-screen flex flex-col justify-between">
|
<div className="min-h-screen flex flex-col justify-between">
|
||||||
<div className="flex-1 overflow-y-auto">
|
<div className="flex-1 overflow-y-auto mb-20">
|
||||||
{metadata ? (
|
{metadata ? (
|
||||||
<div className="mx-10 mt-10 gap-6 pb-6 space-y-6">
|
<div className="mx-10 mt-10 gap-6 pb-6 space-y-6">
|
||||||
<button onClick={() => router.push("/unit")}>
|
<button onClick={() => router.push("/unit")}>
|
||||||
@ -171,7 +171,7 @@ export default function PretestPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="w-full bg-[#113768] h-[78px] flex justify-center items-center border border-transparent text-white font-bold text-2xl hover:bg-[#0d2a52] transition-colors"
|
className="fixed bottom-0 w-full bg-[#113768] h-[78px] flex justify-center items-center border border-transparent text-white font-bold text-2xl hover:bg-[#0d2a52] transition-colors"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
router.push(`/exam/${id}?time=${metadata.metadata.duration}`);
|
router.push(`/exam/${id}?time=${metadata.metadata.duration}`);
|
||||||
|
|||||||
@ -153,17 +153,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.timer {
|
.timer {
|
||||||
width: 120px;
|
width: 160px;
|
||||||
height: 40px;
|
height: 60px;
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeValue {
|
.timeValue {
|
||||||
font-size: 14px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeLabel {
|
.timeLabel {
|
||||||
font-size: 10px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.examHeader {
|
.examHeader {
|
||||||
|
|||||||
Reference in New Issue
Block a user