-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1bfed06
commit 266531d
Showing
18 changed files
with
706 additions
and
656 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
"use client"; | ||
|
||
import { | ||
Button, | ||
Flex, | ||
FormControl, | ||
FormErrorMessage, | ||
FormLabel, | ||
Input, | ||
Text, | ||
Textarea, | ||
} from "@chakra-ui/react"; | ||
import axios from "axios"; | ||
import { useRouter } from "next/navigation"; | ||
import { SubmitHandler, useForm } from "react-hook-form"; | ||
|
||
import { InputStyle } from "@/components/InputStyle"; | ||
import { Link } from "@/components/link"; | ||
|
||
type Inputs = { | ||
email: string; | ||
phone: string; | ||
message: string; | ||
}; | ||
|
||
export default function Contacts() { | ||
const { | ||
handleSubmit, | ||
register, | ||
formState: { errors, isSubmitting, isSubmitSuccessful }, | ||
} = useForm<Inputs>(); | ||
const router = useRouter(); | ||
|
||
const onSubmit: SubmitHandler<Inputs> = async (data) => { | ||
axios.defaults.headers.post["Accept"] = "application/json"; | ||
await axios | ||
.post("https://getform.io/f/761a3fe2-3d7a-49fa-8e52-9831853d010e", data) | ||
.catch((error) => { | ||
console.log("🚀 ~ sendForm ~ error:", error); | ||
}); | ||
router.push("/contacts/confirmation"); | ||
}; | ||
|
||
return ( | ||
<Flex | ||
p={[4, 10]} | ||
mt={[4, 10]} | ||
mb={[0, 10]} | ||
mx="auto" | ||
width="100%" | ||
maxWidth="1000px" | ||
border={[null, "1px dashed"]} | ||
flexDirection={["column", "row"]} | ||
> | ||
<Flex | ||
flexDirection="column" | ||
borderRight={[null, "1px dashed"]} | ||
width="100%" | ||
pr={[0, "60px"]} | ||
pb={[10, 0]} | ||
> | ||
<Text | ||
fontSize={["32px", "60px"]} | ||
lineHeight={["32px", "60px"]} | ||
fontWeight={400} | ||
pb={[4, 10]} | ||
textAlign={["center", "left"]} | ||
> | ||
Witamy | ||
</Text> | ||
<form onSubmit={handleSubmit(onSubmit)}> | ||
<FormControl isInvalid={!!errors.email?.message}> | ||
<FormLabel htmlFor="email">E-mail</FormLabel> | ||
<Input | ||
{...InputStyle} | ||
id="email" | ||
placeholder="Wpisz swój e-mail tutaj..." | ||
{...register("email", { | ||
required: "To pole jest wymagane", | ||
pattern: { | ||
value: /\S+@\S+\.\S+/, | ||
message: "E-mail jest nieprawidłowy", | ||
}, | ||
})} | ||
/> | ||
<FormErrorMessage>{errors.email && errors.email.message}</FormErrorMessage> | ||
</FormControl> | ||
<FormControl isInvalid={!!errors.phone?.message} mt={4}> | ||
<FormLabel htmlFor="phone">Telefon</FormLabel> | ||
<Input | ||
{...InputStyle} | ||
id="phone" | ||
placeholder="Wpisz swój telefon tutaj..." | ||
{...register("phone")} | ||
/> | ||
<FormErrorMessage>{errors.phone && errors.phone.message}</FormErrorMessage> | ||
</FormControl> | ||
<FormControl isInvalid={!!errors.message?.message} mt={4}> | ||
<FormLabel htmlFor="name">Wiadomosć</FormLabel> | ||
<Textarea | ||
{...InputStyle} | ||
id="message" | ||
placeholder="Wpisz swoją wiadomosć tutaj..." | ||
rows={4} | ||
{...register("message", { | ||
required: "To pole jest wymagane", | ||
})} | ||
/> | ||
<FormErrorMessage>{errors.message && errors.message.message}</FormErrorMessage> | ||
</FormControl> | ||
<Flex justifyContent="flex-end"> | ||
<Button | ||
mt={4} | ||
isLoading={isSubmitting} | ||
type="submit" | ||
bg="black" | ||
color="white" | ||
borderRadius="8px" | ||
fontWeight={400} | ||
fontSize="20px" | ||
px={7} | ||
height="44px" | ||
width={["100%", null]} | ||
_hover={{ | ||
bg: "gray.800", | ||
color: "brand.blue", | ||
}} | ||
> | ||
Wysłać | ||
</Button> | ||
</Flex> | ||
</form> | ||
</Flex> | ||
<Flex | ||
flexDirection="column" | ||
paddingLeft={[0, 9]} | ||
maxWidth="360px" | ||
justifyContent="space-between" | ||
> | ||
<Flex flexDirection="column"> | ||
<Text fontSize={["20px", "24px"]} fontWeight={[500, 600]} pb={[2, 6]}> | ||
Nazwa firmy i adres do korespondencji | ||
</Text> | ||
<Text fontSize={["14px", "16px"]} fontWeight={300}> | ||
Volantes Sp z o.o. | ||
</Text> | ||
<Text fontSize={["14px", "16px"]} fontWeight={300}> | ||
NIP: 725 230 67 13 | ||
</Text> | ||
<Text fontSize={["14px", "16px"]} fontWeight={300}> | ||
Aleja Tadeusza Kościuszki 80/82 lok.301 | ||
</Text> | ||
<Text fontSize={["14px", "16px"]} fontWeight={300}> | ||
Łódź 90-437 | ||
</Text> | ||
</Flex> | ||
<Flex flexDirection="column" mt={[4, 0]}> | ||
<Text fontSize={["20px", "24px"]} fontWeight={[500, 600]} pb={[2, 6]}> | ||
Kontakty | ||
</Text> | ||
<Link | ||
href="tel:+48577125400" | ||
fontSize={["14px", "16px"]} | ||
fontWeight={400} | ||
cursor="pointer" | ||
_hover={{ | ||
color: "brand.blue", | ||
}} | ||
> | ||
+48 577 125 400 | ||
</Link> | ||
<Link | ||
href="mailto:[email protected]" | ||
fontSize={["14px", "16px"]} | ||
fontWeight={400} | ||
cursor="pointer" | ||
_hover={{ | ||
color: "brand.blue", | ||
}} | ||
> | ||
[email protected] | ||
</Link> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,187 +1,9 @@ | ||
"use client"; | ||
import { Metadata } from "next"; | ||
|
||
import { | ||
Button, | ||
Flex, | ||
FormControl, | ||
FormErrorMessage, | ||
FormLabel, | ||
Input, | ||
Text, | ||
Textarea, | ||
} from "@chakra-ui/react"; | ||
import axios from "axios"; | ||
import { useRouter } from "next/navigation"; | ||
import { SubmitHandler, useForm } from "react-hook-form"; | ||
import Contacts from "./contacts"; | ||
|
||
import { InputStyle } from "@/components/InputStyle"; | ||
import { Link } from "@/components/link"; | ||
|
||
type Inputs = { | ||
email: string; | ||
phone: string; | ||
message: string; | ||
export const metadata: Metadata = { | ||
title: "Admiral Interior | Kontakty", | ||
}; | ||
|
||
export default function Home() { | ||
const { | ||
handleSubmit, | ||
register, | ||
formState: { errors, isSubmitting, isSubmitSuccessful }, | ||
} = useForm<Inputs>(); | ||
const router = useRouter(); | ||
|
||
const onSubmit: SubmitHandler<Inputs> = async (data) => { | ||
axios.defaults.headers.post["Accept"] = "application/json"; | ||
await axios | ||
.post("https://getform.io/f/761a3fe2-3d7a-49fa-8e52-9831853d010e", data) | ||
.catch((error) => { | ||
console.log("🚀 ~ sendForm ~ error:", error); | ||
}); | ||
router.push("/contacts/confirmation"); | ||
}; | ||
|
||
return ( | ||
<Flex | ||
p={[4, 10]} | ||
mt={[4, 10]} | ||
mb={[0, 10]} | ||
mx="auto" | ||
width="100%" | ||
maxWidth="1000px" | ||
border={[null, "1px dashed"]} | ||
flexDirection={["column", "row"]} | ||
> | ||
<Flex | ||
flexDirection="column" | ||
borderRight={[null, "1px dashed"]} | ||
width="100%" | ||
pr={[0, "60px"]} | ||
pb={[10, 0]} | ||
> | ||
<Text | ||
fontSize={["32px", "60px"]} | ||
lineHeight={["32px", "60px"]} | ||
fontWeight={400} | ||
pb={[4, 10]} | ||
textAlign={["center", "left"]} | ||
> | ||
Witamy | ||
</Text> | ||
<form onSubmit={handleSubmit(onSubmit)}> | ||
<FormControl isInvalid={!!errors.email?.message}> | ||
<FormLabel htmlFor="email">E-mail</FormLabel> | ||
<Input | ||
{...InputStyle} | ||
id="email" | ||
placeholder="Wpisz swój e-mail tutaj..." | ||
{...register("email", { | ||
required: "To pole jest wymagane", | ||
pattern: { | ||
value: /\S+@\S+\.\S+/, | ||
message: "E-mail jest nieprawidłowy", | ||
}, | ||
})} | ||
/> | ||
<FormErrorMessage>{errors.email && errors.email.message}</FormErrorMessage> | ||
</FormControl> | ||
<FormControl isInvalid={!!errors.phone?.message} mt={4}> | ||
<FormLabel htmlFor="phone">Telefon</FormLabel> | ||
<Input | ||
{...InputStyle} | ||
id="phone" | ||
placeholder="Wpisz swój telefon tutaj..." | ||
{...register("phone")} | ||
/> | ||
<FormErrorMessage>{errors.phone && errors.phone.message}</FormErrorMessage> | ||
</FormControl> | ||
<FormControl isInvalid={!!errors.message?.message} mt={4}> | ||
<FormLabel htmlFor="name">Wiadomosć</FormLabel> | ||
<Textarea | ||
{...InputStyle} | ||
id="message" | ||
placeholder="Wpisz swoją wiadomosć tutaj..." | ||
rows={4} | ||
{...register("message", { | ||
required: "To pole jest wymagane", | ||
})} | ||
/> | ||
<FormErrorMessage>{errors.message && errors.message.message}</FormErrorMessage> | ||
</FormControl> | ||
<Flex justifyContent="flex-end"> | ||
<Button | ||
mt={4} | ||
isLoading={isSubmitting} | ||
type="submit" | ||
bg="black" | ||
color="white" | ||
borderRadius="8px" | ||
fontWeight={400} | ||
fontSize="20px" | ||
px={7} | ||
height="44px" | ||
width={["100%", null]} | ||
_hover={{ | ||
bg: "gray.800", | ||
color: "brand.blue", | ||
}} | ||
> | ||
Wysłać | ||
</Button> | ||
</Flex> | ||
</form> | ||
</Flex> | ||
<Flex | ||
flexDirection="column" | ||
paddingLeft={[0, 9]} | ||
maxWidth="360px" | ||
justifyContent="space-between" | ||
> | ||
<Flex flexDirection="column"> | ||
<Text fontSize={["20px", "24px"]} fontWeight={[500, 600]} pb={[2, 6]}> | ||
Nazwa firmy i adres do korespondencji | ||
</Text> | ||
<Text fontSize={["14px", "16px"]} fontWeight={300}> | ||
Volantes Sp z o.o. | ||
</Text> | ||
<Text fontSize={["14px", "16px"]} fontWeight={300}> | ||
NIP: 725 230 67 13 | ||
</Text> | ||
<Text fontSize={["14px", "16px"]} fontWeight={300}> | ||
Aleja Tadeusza Kościuszki 80/82 lok.301 | ||
</Text> | ||
<Text fontSize={["14px", "16px"]} fontWeight={300}> | ||
Łódź 90-437 | ||
</Text> | ||
</Flex> | ||
<Flex flexDirection="column" mt={[4, 0]}> | ||
<Text fontSize={["20px", "24px"]} fontWeight={[500, 600]} pb={[2, 6]}> | ||
Kontakty | ||
</Text> | ||
<Link | ||
href="tel:+48577125400" | ||
fontSize={["14px", "16px"]} | ||
fontWeight={400} | ||
cursor="pointer" | ||
_hover={{ | ||
color: "brand.blue", | ||
}} | ||
> | ||
+48 577 125 400 | ||
</Link> | ||
<Link | ||
href="mailto:[email protected]" | ||
fontSize={["14px", "16px"]} | ||
fontWeight={400} | ||
cursor="pointer" | ||
_hover={{ | ||
color: "brand.blue", | ||
}} | ||
> | ||
[email protected] | ||
</Link> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
); | ||
} | ||
export default Contacts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.