Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quiz layout changed with bigger map area and rules overlay #15

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions app/quiz/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import styles from "./page.module.scss";
import { useState, useEffect, useRef } from "react";
import { useSession } from "next-auth/react";
import { signIn, signOut } from 'next-auth/react';
import { signIn, signOut } from "next-auth/react";
import Question from "@/components/Questioncomponent/Question";
import Quizrules from "@/components/Rulesquiz/rulesquiz";

Expand All @@ -14,7 +14,7 @@ export default function Quiz() {
const animationRef = useRef<CarAnimation | null>(null);

useEffect(() => {
if (typeof window !== 'undefined' && containerRef.current) {
if (typeof window !== "undefined" && containerRef.current) {
const animation = new CarAnimation(containerRef.current);
animation.start();
animationRef.current = animation;
Expand All @@ -32,13 +32,17 @@ export default function Quiz() {
}, [isCorrect]);

return (
<><div className={styles.main}>
{/* <Quizrules/> */}
<div ref={containerRef} />
<Question isCorrect={isCorrect} setIsCorrect={setIsCorrect} />
<div className={`${styles.overlay} ${isCorrect ? styles.overlayActive : ""}`}></div>

</div>
</>
<>
<div className={styles.main}>
{/* <Quizrules/> */}
<div ref={containerRef} />
<Question isCorrect={isCorrect} setIsCorrect={setIsCorrect} />
<div
className={`${styles.overlay} ${
isCorrect ? styles.overlayActive : ""
}`}
></div>
</div>
</>
);
}
2 changes: 1 addition & 1 deletion components/MainQuestion/MainQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function MainQuestion({ isCorrect , setIsCorrect , onCorrectAnswer}: MainQuestio
placeholder="Enter your answer"
className={style.input}
/>
<Submit/>
<Submit />
</form>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion components/Map/map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Map = () => {
mapRef.current = new mapboxgl.Map({
container: mapContainerRef.current,
center: [-74.5, 40], // starting position [lng, lat]
zoom: 9 // starting zoom
zoom: 3 // starting zoom
});
});

Expand Down
2 changes: 1 addition & 1 deletion components/Questioncomponent/Question.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

.outerquestion {
height: 70vh;
width: 36%;
width: 70%;
background-color: rgba(9, 255, 0, 0.89);
clip-path: polygon(0 0, 91% 0, 100% 13%, 100% 100%, 16% 100%, 0 90%);
display: flex;
Expand Down
66 changes: 48 additions & 18 deletions components/Questioncomponent/Question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styles from "./Question.module.scss";
import { Tabs } from "../Tabs/tabs";
import MainQuestion from "../MainQuestion/MainQuestion";
import Map from "@/components/Map/map";
import Rulescard from "../Rulescard/rulescard";

interface QuestionProps {
isCorrect: boolean;
Expand All @@ -12,6 +13,7 @@ interface QuestionProps {

const Question: React.FC<QuestionProps> = ({ isCorrect, setIsCorrect }) => {
const [tabs, setTabs] = useState([]);
const [rulesShow, setRulesShow] = useState(false);

useEffect(() => {
const fetchTabs = async () => {
Expand Down Expand Up @@ -49,38 +51,66 @@ const Question: React.FC<QuestionProps> = ({ isCorrect, setIsCorrect }) => {

return (
<>
<button
onClick={() => window.history.back()}
className="absolute top-4 left-4 ml-12 mt-8 text-white cursor-pointer flex items-center justify-center p-2 rounded-full bg-[rgba(44,255,5,0.1)] border-2 transition-transform transform hover:scale-105 border-[rgba(44,255,5,0.7)] hover:bg-white hover:border-transparent hover:text-black shadow-lg"
<div
style={{
boxShadow: "0 4px 8px rgba(0,0,0,0.2)",
width: "100%",
display: "flex",
justifyContent: "space-around",
alignItems: "center",
}}
>
<span
className="text-lg font-bold"
<button
onClick={() => window.history.back()}
className="absolute top-4 left-4 ml-12 mt-8 text-white cursor-pointer flex items-center justify-center p-2 rounded-full bg-[rgba(44,255,5,0.1)] border-2 transition-transform transform hover:scale-105 border-[rgba(44,255,5,0.7)] hover:bg-white hover:border-transparent hover:text-black shadow-lg"
style={{
boxShadow: "0 4px 8px rgba(0,0,0,0.2)",
}}
>
<span
className="text-lg font-bold"
style={{
display: "inline-block",
transform: "rotate(180deg)",
marginRight: "5px",
}}
>
</span>
Back
</button>
<button
onClick={() => setRulesShow(true)}
className="absolute top-4 left-4 ml-12 mt-8 text-white cursor-pointer flex items-center justify-center p-2 rounded-full bg-[rgba(44,255,5,0.1)] border-2 transition-transform transform hover:scale-105 border-[rgba(44,255,5,0.7)] hover:bg-white hover:border-transparent hover:text-black shadow-lg"
style={{
display: "inline-block",
transform: "rotate(180deg)",
marginRight: "5px",
boxShadow: "0 4px 8px rgba(0,0,0,0.2)",
padding: "10px 18px",
marginLeft: "90vw",
}}
>
</span>
Back
</button>
Rules
</button>
</div>
{rulesShow && (
<Rulescard rulesShow={rulesShow} setRulesShow={setRulesShow} />
)}
<div className={styles.main}>
<div className={styles.outerquestion}>
<div className={styles.question}>
<div className={styles.cluemap} style={{ marginRight: "80px" }}>
<div className={styles.map} style={{ marginBottom: "40px" }}>
<MainQuestion
isCorrect={isCorrect}
setIsCorrect={setIsCorrect}
onCorrectAnswer={handleCorrectAnswer}
/>
</div>
</div>
<div className={styles.cluemap}>
<Tabs tabs={tabs} />
<div className={styles.map}>
</div>
<div className={styles.outerquestion}>
<div className={styles.question}>
{/* <MainQuestion
isCorrect={isCorrect}
setIsCorrect={setIsCorrect}
onCorrectAnswer={handleCorrectAnswer}
/> */}
<Map />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/Submitbutton/submitbutton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from './submit.module.scss';

export default function Submit() {
return (
<button className={styles.DownloadButton}>
<button className={styles.DownloadButton} style={{marginBottom: "40px"}}>
<svg
xmlns="http://www.w3.org/2000/svg"
height="32"
Expand Down
2 changes: 1 addition & 1 deletion components/Tabs/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

.outerFadeIn {
position: absolute;
width: 90%; /* Fixed width */
width: 100%; /* Fixed width */
height: 60%; /* Fixed height */
background-color: rgba(9, 255, 0, 0.89);
clip-path: polygon(0 0, 91% 0, 100% 13%, 100% 100%, 16% 100%, 0 90%);
Expand Down