2024-06-02 21:32:33 +03:00
|
|
|
"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="relative isolate px-6 pt-14 lg:px-8">
|
|
|
|
<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> */ }
|
2024-06-03 21:46:58 +03:00
|
|
|
<Form fields={[{type: FieldType.text, name: "meow", required: false, placeholder: "Insert your answer here:"}]} onSubmit={formSubmit} />
|
2024-06-02 21:32:33 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default FormQuestion;
|