wipo
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
import { Form, useForm } from "react-hook-form";
|
import { Form, useForm } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { createElement } from "react";
|
import { createElement, useEffect } from "react";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
const N8N_URL = "https://n8n.eduseg.com.br/webhook/eduseg";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
name: z.string().nonempty({ message: "Deve preencher o nome" }),
|
name: z.string().nonempty({ message: "Deve preencher o nome" }),
|
||||||
email: z
|
email: z
|
||||||
@@ -15,14 +17,17 @@ const schema = z.object({
|
|||||||
message: z.string().nonempty({ message: "Deve preencher a mensagem" }),
|
message: z.string().nonempty({ message: "Deve preencher a mensagem" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function Contact() {
|
export default function Contact({ url }) {
|
||||||
const { register, formState, control, reset } = useForm({
|
const { register, formState, control, reset } = useForm({
|
||||||
resolver: zodResolver(schema),
|
resolver: zodResolver(schema),
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
action="https://n8n.eduseg.com.br/webhook/a377b3e0-b159-4536-98ab-e13822b60562"
|
action={N8N_URL}
|
||||||
|
onSubmit={(data) => {
|
||||||
|
return { url, ...data };
|
||||||
|
}}
|
||||||
onSuccess={() => reset()}
|
onSuccess={() => reset()}
|
||||||
control={control}
|
control={control}
|
||||||
className="flex flex-col gap-3"
|
className="flex flex-col gap-3"
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ const { title } = Astro.props;
|
|||||||
aria-labelledby="Fechar"
|
aria-labelledby="Fechar"
|
||||||
x-on:click="open = false"
|
x-on:click="open = false"
|
||||||
>
|
>
|
||||||
<Icon name="x-mark" />
|
<Icon name="x-mark" class="size-4" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="border-b border-black pb-6 lg:pb-12 mb-6 lg:mb-12">
|
<div class="border-b border-black pb-6 lg:pb-12 mb-6 lg:mb-12">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from "astro-icon/components";
|
import { Icon } from "astro-icon/components";
|
||||||
import Container from "~/components/Container.astro";
|
import Container from "~/components/Container.astro";
|
||||||
import Form from "./Contact.jsx";
|
import Contact from "./Contact.jsx";
|
||||||
---
|
---
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -27,7 +27,7 @@ import Form from "./Contact.jsx";
|
|||||||
{/* Close button */}
|
{/* Close button */}
|
||||||
<button
|
<button
|
||||||
x-on:click="open = false"
|
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" />
|
<Icon name="x-mark" class="size-4" />
|
||||||
</button>
|
</button>
|
||||||
@@ -35,7 +35,7 @@ import Form from "./Contact.jsx";
|
|||||||
<h1 class="text-3xl lg:text-4xl font-medium">
|
<h1 class="text-3xl lg:text-4xl font-medium">
|
||||||
Preencha os dados da sua empresa
|
Preencha os dados da sua empresa
|
||||||
</h1>
|
</h1>
|
||||||
<Form client:load />
|
<Contact url={Astro.request.url} client:load />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user