Baba

import React, { useState } from "react"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; const questions = [ { question: "तुम्हारा पसंदीदा खाना कौन सा है?", options: ["पिज़्ज़ा", "बिरयानी", "राजमा चावल", "खुद का जवाब लिखें"] }, { question: "तुम किस तरह की फिल्में देखना पसंद करते हो?", options: ["कॉमेडी", "रोमांटिक", "थ्रिलर", "खुद का जवाब लिखें"] }, { question: "तुम्हें घूमने के लिए कौन सी जगह पसंद है?", options: ["पहाड़", "समंदर", "गांव", "खुद का जवाब लिखें"] }, { question: "तुम्हारा सपना क्या है?", options: ["आईएएस बनना", "बिज़नेसमैन", "साफ-सुथरी ज़िंदगी", "खुद का जवाब लिखें"] }, { question: "तुम अपने पार्टनर में सबसे ज़्यादा क्या पसंद करते हो?", options: ["ईमानदारी", "सादगी", "हास्यभाव", "खुद का जवाब लिखें"] } ]; export default function MatchGame() { const [answersBoy, setAnswersBoy] = useState(Array(questions.length).fill("")); const [answersGirl, setAnswersGirl] = useState(Array(questions.length).fill("")); const [step, setStep] = useState("boy"); const [match, setMatch] = useState(null); const handleChange = (index, value, gender) => { const updatedAnswers = gender === "boy" ? [...answersBoy] : [...answersGirl]; updatedAnswers[index] = value; gender === "boy" ? setAnswersBoy(updatedAnswers) : setAnswersGirl(updatedAnswers); }; const handleSubmit = () => { if (step === "boy") { setStep("girl"); } else { const isMatch = answersBoy.every((ans, i) => ans.trim().toLowerCase() === answersGirl[i].trim().toLowerCase()); setMatch(isMatch); setStep("result"); } }; return (
{step === "result" ? (

परिणाम

{match ? ( <>

बधाई हो! आपके विचार मिलते हैं।

अब आप एक-दूसरे से नंबर एक्सचेंज कर सकते हैं।

) : (

अफसोस! आपके विचार नहीं मिले।

)}
) : (

{step === "boy" ? "लड़के के लिए सवाल" : "लड़की के लिए सवाल"}

{questions.map((q, i) => (

{q.question}

{q.options.map((opt, idx) => (
handleChange(i, e.target.value, step)} />
))} {(step === "boy" ? answersBoy[i] : answersGirl[i]) === "खुद का जवाब लिखें" && ( handleChange(i, e.target.value, step)} /> )}
))}
)}
); }

टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट

हिंदी में chatgpt खोजिए

Mindset game