This commit is contained in:
2025-04-30 14:23:08 -03:00
parent 142bcf410a
commit ca917438bf
3 changed files with 12 additions and 7 deletions

View File

@@ -1,9 +1,11 @@
import { Form, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { createElement } from "react";
import { createElement, useEffect } from "react";
import clsx from "clsx";
import { z } from "zod";
const N8N_URL = "https://n8n.eduseg.com.br/webhook/eduseg";
const schema = z.object({
name: z.string().nonempty({ message: "Deve preencher o nome" }),
email: z
@@ -15,14 +17,17 @@ const schema = z.object({
message: z.string().nonempty({ message: "Deve preencher a mensagem" }),
});
export default function Contact() {
export default function Contact({ url }) {
const { register, formState, control, reset } = useForm({
resolver: zodResolver(schema),
});
return (
<Form
action="https://n8n.eduseg.com.br/webhook/a377b3e0-b159-4536-98ab-e13822b60562"
action={N8N_URL}
onSubmit={(data) => {
return { url, ...data };
}}
onSuccess={() => reset()}
control={control}
className="flex flex-col gap-3"

View File

@@ -57,7 +57,7 @@ const { title } = Astro.props;
aria-labelledby="Fechar"
x-on:click="open = false"
>
<Icon name="x-mark" />
<Icon name="x-mark" class="size-4" />
</button>
<div class="border-b border-black pb-6 lg:pb-12 mb-6 lg:mb-12">

View File

@@ -1,7 +1,7 @@
---
import { Icon } from "astro-icon/components";
import Container from "~/components/Container.astro";
import Form from "./Contact.jsx";
import Contact from "./Contact.jsx";
---
<div
@@ -27,7 +27,7 @@ import Form from "./Contact.jsx";
{/* Close button */}
<button
x-on:click="open = false"
class="cursor-pointer absolute top-2.5 right-2.5 lg:top-5 lg:right-5 border border-white rounded-full"
class="cursor-pointer absolute top-2.5 right-2.5 lg:top-5 lg:right-5 border border-white rounded-full p-px"
>
<Icon name="x-mark" class="size-4" />
</button>
@@ -35,7 +35,7 @@ import Form from "./Contact.jsx";
<h1 class="text-3xl lg:text-4xl font-medium">
Preencha os dados da sua empresa
</h1>
<Form client:load />
<Contact url={Astro.request.url} client:load />
</div>
</div>
</div>