Skip to content

Commit 7df1c68

Browse files
committed
Fix Select registration
1 parent 76650cf commit 7df1c68

File tree

1 file changed

+25
-8
lines changed
  • apps/dashboard/src/app/onboarding

1 file changed

+25
-8
lines changed

apps/dashboard/src/app/onboarding/page.tsx

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export default function OnboardingPage() {
7676
handleSubmit,
7777
formState: { errors },
7878
trigger,
79+
setValue,
7980
} = useForm<FormData>({
8081
defaultValues: {
8182
interests: [],
@@ -94,14 +95,20 @@ export default function OnboardingPage() {
9495
? ["userType", "name", "role", "industry"]
9596
: ["interests"];
9697
const isStepValid = await trigger(fields as Array<keyof FormData>);
97-
if (isStepValid) setStep(step + 1);
98+
if (isStepValid) {
99+
setStep(step + 1);
100+
fields.map((field) => {
101+
register(field as keyof FormData);
102+
});
103+
}
98104
};
99105

100106
const Step1: React.FC<StepProps> = ({ register, errors }) => (
101107
<div>
102-
<FormControl className="flex flex-col space-y-2">
108+
<FormControl className="box-border flex-col space-y-2">
103109
<FormLabel>What's your email?</FormLabel>
104110
<Input
111+
className="w-1/2"
105112
id="email"
106113
type="email"
107114
placeholder="[email protected]"
@@ -145,6 +152,7 @@ export default function OnboardingPage() {
145152
<FormControl className="flex flex-col space-y-2">
146153
<FormLabel>What's the name of your company?</FormLabel>
147154
<Input
155+
className="w-1/2"
148156
id="name"
149157
type="text"
150158
placeholder="Hooli, Inc."
@@ -153,8 +161,13 @@ export default function OnboardingPage() {
153161
</FormControl>
154162
<FormControl className="flex flex-col space-y-2">
155163
<FormLabel>What's your role?</FormLabel>
156-
<Select {...register("role")}>
157-
<SelectTrigger className="w-[180px]">
164+
<Select
165+
onValueChange={(value) => {
166+
setValue("role", value);
167+
console.log(value);
168+
}}
169+
>
170+
<SelectTrigger className="w-1/2">
158171
<SelectValue placeholder={"Select Role"} />
159172
</SelectTrigger>
160173
<SelectContent>
@@ -181,8 +194,12 @@ export default function OnboardingPage() {
181194
</FormControl>
182195
<FormControl className="flex flex-col space-y-2">
183196
<FormLabel>What industry is your company in?</FormLabel>
184-
<Select {...register("industry")}>
185-
<SelectTrigger className="w-[180px]">
197+
<Select
198+
onValueChange={(value) => {
199+
setValue("industry", value);
200+
}}
201+
>
202+
<SelectTrigger className="w-1/2">
186203
<SelectValue placeholder={"Select Industry"} />
187204
</SelectTrigger>
188205
<SelectContent>
@@ -331,7 +348,7 @@ export default function OnboardingPage() {
331348
<div className="relative flex h-screen place-items-center bg-muted/30 md:flex-row">
332349
<main className="z-10 flex w-full gap-6">
333350
{/* Left Panel */}
334-
<div className="items-between relative flex h-screen w-1/2 flex-col p-12">
351+
<div className="items-between relative box-border flex h-screen w-1/2 flex-col p-12">
335352
<div className="flex flex-col space-y-2">
336353
<h1 className="font-semibold text-xl tracking-tight">
337354
{step === 3 ? "Tell us what you need." : "Tell us about you."}
@@ -345,7 +362,7 @@ export default function OnboardingPage() {
345362
{step === 2 && <Step2 register={register} errors={errors} />}
346363
{step === 3 && <Step3 register={register} errors={errors} />}
347364
</form>
348-
<div className="absolute bottom-12 box-border flex w-full items-center justify-between">
365+
<div className="absolute right-0 bottom-0 left-0 box-border flex w-full items-center justify-between overflow-auto p-12">
349366
{/* Stepper */}
350367
<div className="flex space-x-4">
351368
<div

0 commit comments

Comments
 (0)