Skip to content

Commit

Permalink
fix: Comments resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorschelb committed Jul 7, 2023
1 parent 2705382 commit 9de974b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 36 deletions.
11 changes: 7 additions & 4 deletions src/app/app/onboarding/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Form() {
content: Component,
} = useOnboardingForm(stepNumber, steps);

function onComponentSubmit() {
function onSubmit() {
// TODO: call submit if it's the last step
moveNextStep();
}
Expand All @@ -36,7 +36,7 @@ export default function Form() {
<div className="bg-white">
<div className="grid gap-4 max-w-sm mx-auto">
<div className="flex-1">
<Component moveNextStep={moveNextStep} onSubmit={onComponentSubmit} />
<Component moveNextStep={moveNextStep} onSubmit={onSubmit} />
</div>

<div className="flex justify-between">
Expand All @@ -50,8 +50,11 @@ export default function Form() {

<div>
{steps.map((_, idx) => (
// eslint-disable-next-line react/jsx-max-props-per-line
<StepDot idx={idx} key={idx} step={step} />
<StepDot
idx={idx}
key={idx}
step={step}
/>
))}
</div>

Expand Down
26 changes: 0 additions & 26 deletions src/components/forms/OnboardingContact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,6 @@ export default function OnboardingContact(props: FormProps) {
"email"
]);

// function onSubmit(data: ContactSchema) {
// // props.onSubmit();
// // console.log(data);
// const isValid = contactSchema.safeParse(data);
// if (isValid.success) {
// props.moveNextStep();
// console.log(data);
// return;
// }
// console.log("Dados inválidos:", isValid.error);
// return;
// }

// function onSubmit(data: contactSchema) {
// // props.onSubmit();
// // console.log(data);
// const isValid = contactSchema.safeParse(data);
// if (isValid.success) {
// props.moveNextStep();
// console.log(data);
// } else {
// console.log("Dados inválidos:", isValid.error);
// }

// }

function onSubmit(data: ContactSchema) {
const isValid = contactSchema.safeParse(data);
isValid.success
Expand Down
6 changes: 0 additions & 6 deletions src/shared/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ export type AboutSchema = z.infer<typeof aboutSchema>;
export type ContactSchema = z.infer<typeof contactSchema>;
export type ProfessionalSchema = z.infer<typeof professionalSchema>;

// TESTE DE VALIDAÇÃO
// .refine((data) => {
// const age = parseInt(data.idade, 10);
// return !isNaN(age) && age >= 18 && age <= 120;
// });

export const registrationSchema = z.object({
nomeSocial: z
.string()
Expand Down

0 comments on commit 9de974b

Please sign in to comment.