From 55b8d8759b884c6e5ab4575d7b4ce9cfb31cf869 Mon Sep 17 00:00:00 2001 From: THIS ONE IS A LITTLE BIT TRICKY KRUB Date: Thu, 10 Oct 2024 17:06:19 +0700 Subject: [PATCH] Refactor Apply page component to use Selector component for handling yes/no choices --- src/app/business/apply/page.tsx | 131 ++++++++++++-------------------- src/components/selector.tsx | 46 +++++++++++ 2 files changed, 93 insertions(+), 84 deletions(-) create mode 100644 src/components/selector.tsx diff --git a/src/app/business/apply/page.tsx b/src/app/business/apply/page.tsx index 309900c..a6bf7a3 100644 --- a/src/app/business/apply/page.tsx +++ b/src/app/business/apply/page.tsx @@ -24,6 +24,7 @@ import { } from "@/components/ui/tooltip"; import { z } from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; +import { Selector } from "@/components/selector"; export default function Apply() { const formSchema = z.object({ @@ -237,104 +238,66 @@ export default function Apply() { {/* Is your company incorporated in the United States? */} -
- -
-
- - - -
- + + Is your company incorporated in the
+ United States? + + } + name="isInUS" + choice1="Yes" + choice2="No" + handleFunction={handleFieldChange} + description={ + <> Only companies that are incorporated or formed in the US are{" "}
eligible to raise via Reg CF. If your company is incorporated{" "}
outside the US, we still encourage you to apply. -
-
-
+ + } + value={isInUS} + /> {/* Is your product available (for sale) in market? */} -
- -
-
- - -
- + + Is your product available (for sale)
+ in market? + + } + name="isForSale" + choice1="Yes" + choice2="No" + handleFunction={handleFieldChange} + description={ + <> Only check this box if customers can access, use, or buy your{" "}
product today. -
-
-
+ + } + value={isForSale} + /> {/* Is your company generating revenue?*/} -
- -
-
- - -
- + Is your company generating revenue?} + name="isGenerating" + choice1="Yes" + choice2="No" + handleFunction={handleFieldChange} + description={ + <> Only check this box if your company is making money.
Please elaborate on revenue and other traction below. -
-
-
+ + } + value={isGenerating} + /> {/* Pitch deck */}
diff --git a/src/components/selector.tsx b/src/components/selector.tsx new file mode 100644 index 0000000..d0e0206 --- /dev/null +++ b/src/components/selector.tsx @@ -0,0 +1,46 @@ +import { Label } from "@/components/ui/label"; +import { Button } from "@/components/ui/button"; +import { ReactElement } from "react"; + +interface SelectorInterface { + label: ReactElement; + name: string; + choice1: string; + choice2: string; + handleFunction: Function; + value: string; + description: ReactElement; +} + +export function Selector(props: SelectorInterface) { + return ( +
+ +
+
+ + +
+ + {props.description} + +
+
+ ); +}