diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 901198d..e83becd 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,5 +1,4 @@ import { type NextPage } from "next"; -import Head from "next/head"; import Link from "next/link"; import { ArrowUpRightIcon } from '@heroicons/react/20/solid'; diff --git a/src/pages/resources/survey.tsx b/src/pages/resources/survey.tsx index 6cb0121..4ba9628 100644 --- a/src/pages/resources/survey.tsx +++ b/src/pages/resources/survey.tsx @@ -1,5 +1,4 @@ -import { type Dispatch, type SetStateAction, useEffect, useState } from "react"; -import { GuidedSurvey, type Question, type QuestionTypes, type Option } from "~/components/Survey"; +import { GuidedSurvey, type Question, type QuestionTypes } from "~/components/Survey"; const questions: Question[] = [ { @@ -101,94 +100,6 @@ const questions: Question[] = [ }, ] -const ChoiceQuestion = ({question, formData, updateFormData}: {question: Question, formData: Record, updateFormData: Dispatch>>}) => { - const OptionToggle = ({option}: {option: Option}) => { - const selected = formData[question.for]?.includes(option.value) ?? false; - - const handleToggle = () => { - const newFormData = { - ...formData - }; - - if (!newFormData[question.for]) { - newFormData[question.for] = [option.value]; - } else if (newFormData[question.for]?.includes(option.value)) { - newFormData[question.for] = newFormData[question.for]?.filter(function(item) { - return item !== option.value - }) ?? []; - } else { - newFormData[question.for] = [...newFormData[question.for] ?? [], option.value]; - } - - updateFormData(newFormData); - } - - return ( - - ) - } - - useEffect(() => { - if (!formData[question.for]) { - const newFormData = {...formData}; - newFormData[question.for] = []; - - updateFormData(newFormData); - } - }); - - const htmlOptions: JSX.Element[] = [] - const optionButtons: JSX.Element[] = [] - - question.options.forEach((option, index) => { - optionButtons.push() - htmlOptions.push() - }); - - return ( -
- -

{question.question}

- -
- {optionButtons} -
-
- ) -} - -const SearchForm = ({questions}: {questions: Question[]}) => { - const [formData, setFormData] = useState<(Record)>({}); - - const questionComponents = questions.map((question, index) => { - return - }) - - return ( -
- {questionComponents} - -
- ) -} - -// const SearchPage = () => { -// return <> -//
-//
-//

Search

-//
-//
-// -//
-//
-// -// } - const SearchPage = () => { return (