added the forum type for real
Signed-off-by: Ioan Chelaru Cristian <iccjoc@localhost.localdomain>
This commit is contained in:
parent
71e0727d98
commit
92a9233e1a
2 changed files with 159 additions and 0 deletions
82
app/components/form-question.tsx
Normal file
82
app/components/form-question.tsx
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
"use client";
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { Button, Description, Dialog, DialogPanel, Field, Input, Label } from '@headlessui/react'
|
||||||
|
import { Bars3Icon, CheckCircleIcon, Square2StackIcon, XCircleIcon, XMarkIcon } from '@heroicons/react/24/outline'
|
||||||
|
import Logo from './logo';
|
||||||
|
import Form, { FieldType } from './form';
|
||||||
|
import { Question } from '../lib/question';
|
||||||
|
|
||||||
|
const FormQuestion = ({question}: {question: Question}) => {
|
||||||
|
|
||||||
|
const [formData, setFormData] = useState<FormData>();
|
||||||
|
|
||||||
|
// const formSubmit = (e) => {
|
||||||
|
// e.preventDefault();
|
||||||
|
|
||||||
|
// setFormData( new FormData( e.target ) );
|
||||||
|
// }
|
||||||
|
|
||||||
|
const formSubmit = (data: FormData) => setFormData( data );
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-black">
|
||||||
|
<div className="relative isolate px-6 pt-14 lg:px-8">
|
||||||
|
<div
|
||||||
|
className="absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]"
|
||||||
|
style={{
|
||||||
|
clipPath:
|
||||||
|
'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<Logo/>
|
||||||
|
<div className="mx-auto max-w-2xl py-32 sm:py-48 lg:py-56">
|
||||||
|
<div className="text-center">
|
||||||
|
<h3 className="text-s font-bold tracking-tight text-gray-500 sm:text-s">This does not work yet, and is work in progress</h3>
|
||||||
|
<h1 className="text-4xl font-bold tracking-tight text-white sm:text-6xl">
|
||||||
|
{question.text}
|
||||||
|
<br/>
|
||||||
|
{/* {formData && JSON.stringify(Object.fromEntries(formData.entries()))} */}
|
||||||
|
{/* {JSON.stringify(formData)} */}
|
||||||
|
</h1>
|
||||||
|
{/* <form className="mt-10 flex items-center justify-center gap-x-6" onSubmit={formSubmit}>
|
||||||
|
<Field>
|
||||||
|
<Description className="text-sm/6 text-white/50"> Type your answer here: </Description>
|
||||||
|
<Input
|
||||||
|
name="test"
|
||||||
|
className=
|
||||||
|
'mt-3 block w-full rounded-lg border-none bg-white/5 py-1.5 px-3 text-sm/6 text-white focus:outline-none data-[focus]:outline-2 data-[focus]:-outline-offset-2 data-[focus]:outline-white/25'
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
<Button
|
||||||
|
className="mt-9 inline-flex items-center gap-2 rounded-md bg-white py-1.5 px-3 text-sm/6 font-semibold text-black shadow-inner shadow-white/10 focus:outline-none data-[hover]:bg-gray-200 data-[open]:bg-gray-200 data-[focus]:outline-1 data-[focus]:outline-white"
|
||||||
|
type='submit'
|
||||||
|
>
|
||||||
|
Send
|
||||||
|
</Button>
|
||||||
|
</form> */ }
|
||||||
|
<Form fields={[{type: FieldType.text, name: "meow", required: false, placeholder: "ermmm what the sigma"},{type: FieldType.text, name: "meow", required: false, placeholder: "ermmm what the sigma"}]} onSubmit={formSubmit} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="relative left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 bg-gradient-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%+36rem)] sm:w-[72.1875rem]"
|
||||||
|
style={{
|
||||||
|
clipPath:
|
||||||
|
'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default FormQuestion;
|
77
app/quiz-temp/page.tsx
Normal file
77
app/quiz-temp/page.tsx
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
"use client";
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { Dialog, DialogPanel } from '@headlessui/react'
|
||||||
|
import { Bars3Icon, CheckCircleIcon, Square2StackIcon, XCircleIcon, XMarkIcon } from '@heroicons/react/24/outline'
|
||||||
|
import Logo from '../components/logo';
|
||||||
|
|
||||||
|
export default function Example() {
|
||||||
|
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="bg-black">
|
||||||
|
<div className="relative isolate px-6 pt-14 lg:px-8">
|
||||||
|
<div
|
||||||
|
className="absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]"
|
||||||
|
style={{
|
||||||
|
clipPath:
|
||||||
|
'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<Logo/>
|
||||||
|
<div className="mx-auto max-w-2xl py-32 sm:py-48 lg:py-56">
|
||||||
|
<div className="text-center">
|
||||||
|
<h3 className="text-s font-bold tracking-tight text-gray-500 sm:text-s">This does not work yet, and is work in progress</h3>
|
||||||
|
<h1 className="text-4xl font-bold tracking-tight text-white sm:text-6xl">
|
||||||
|
[question]
|
||||||
|
</h1>
|
||||||
|
<div className="mt-10 flex items-center justify-center gap-x-6">
|
||||||
|
<button
|
||||||
|
className="rounded-md bg-green-600 px-3.5 py-2.5 text-s font-semibold text-white shadow-sm hover:bg-green-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||||
|
style={{minWidth:'40%', minHeight:'40%', maxWidth:'40%', maxHeight:'40%'}}
|
||||||
|
>
|
||||||
|
[answer1]
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="rounded-md bg-red-600 px-3.5 py-2.5 text-s font-semibold text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||||
|
style={{minWidth:'40%', minHeight:'40%', maxWidth:'40%', maxHeight:'40%'}}
|
||||||
|
>
|
||||||
|
[answer2]
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="mt-5 flex items-center justify-center gap-x-6">
|
||||||
|
<button
|
||||||
|
className="rounded-md bg-blue-600 px-3.5 py-2.5 text-s font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||||
|
style={{minWidth:'40%', minHeight:'40%', maxWidth:'40%', maxHeight:'40%'}}
|
||||||
|
>
|
||||||
|
[answer3]
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="rounded-md bg-yellow-600 px-3.5 py-2.5 text-s font-semibold text-white shadow-sm hover:bg-yellow-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||||
|
style={{minWidth:'40%', minHeight:'40%', maxWidth:'40%', maxHeight:'40%'}}
|
||||||
|
>
|
||||||
|
[answer4]
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="relative left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 bg-gradient-to-tr from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%+36rem)] sm:w-[72.1875rem]"
|
||||||
|
style={{
|
||||||
|
clipPath:
|
||||||
|
'polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
Loading…
Reference in a new issue