Skip to content

Commit ccb143b

Browse files
committed
feat: contact page deescription
1 parent 6a9e8fa commit ccb143b

9 files changed

Lines changed: 9078 additions & 18 deletions

export/pages.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/blocks/ContactBlock.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ export const ContactBlock: Block = {
1414
localized: true,
1515
defaultValue: "Contact us",
1616
},
17+
{
18+
name: "description",
19+
type: "textarea",
20+
required: true,
21+
localized: true,
22+
},
1723
{
1824
name: "nameLabel",
1925
type: "text",

src/components/ContactPageContent.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ interface ContactPageContentProps {
1313

1414
export function ContactPageContent({ locale, contactBlock }: ContactPageContentProps) {
1515
const desktopTopOffset = 96
16+
const pageHeading = contactBlock?.heading ?? "Contact us"
17+
const pageDescription = contactBlock?.description ?? "Contact us if you want to know more about CodeZero."
18+
1619
const [desktopMode, setDesktopMode] = useState<"static" | "fixed" | "bottom">("static")
1720
const [desktopStyle, setDesktopStyle] = useState<{ left: number, width: number, top: number } | null>(null)
21+
1822
const desktopWrapperRef = useRef<HTMLElement>(null)
1923
const desktopContainerRef = useRef<HTMLDivElement>(null)
2024

@@ -77,13 +81,8 @@ export function ContactPageContent({ locale, contactBlock }: ContactPageContentP
7781
return (
7882
<div className="grid gap-8 lg:grid-cols-5">
7983
<section className="min-w-0 lg:col-span-3">
80-
<h1 className="text-4xl font-semibold text-white">Get in touch</h1>
81-
<p className="mt-4 text-white/75">
82-
Placeholder text for the contact page intro. Replace this with the final markdown content.
83-
</p>
84-
<p className="mt-4 text-white/75">
85-
Add details about support, response times, or how the team can help to give visitors more context.
86-
</p>
84+
<h1 className="text-4xl font-semibold text-white">{pageHeading}</h1>
85+
<p className="mt-4 text-white/75">{pageDescription}</p>
8786
</section>
8887

8988
<section ref={desktopWrapperRef} className="relative min-w-0 lg:col-span-2">

src/components/forms/ContactForm.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import { AcceptTermsCheckbox } from "@/components/AcceptTermsCheckbox"
44
import type { AppLocale } from "@/lib/i18n"
55
import { Button, EmailInput, emailValidation, TextAreaInput, TextInput, useForm } from "@code0-tech/pictor"
6+
import type { FocusEvent } from "react"
67
import { useMemo, useState } from "react"
78
import { useWebHaptics } from "web-haptics/react"
89

910
interface ContactFormContent {
10-
heading: string
1111
nameLabel: string
1212
namePlaceholder: string
1313
emailLabel: string
@@ -22,8 +22,14 @@ interface ContactFormProps {
2222
locale: AppLocale
2323
}
2424

25+
interface ContactFormValues {
26+
name: string
27+
email: string
28+
message: string
29+
acceptTerms: boolean
30+
}
31+
2532
const defaultContent: ContactFormContent = {
26-
heading: "Contact us",
2733
nameLabel: "Name",
2834
namePlaceholder: "Your name",
2935
emailLabel: "Email",
@@ -39,7 +45,7 @@ export function ContactForm({ content, locale }: ContactFormProps) {
3945

4046
const [isSubmitting, setIsSubmitting] = useState(false)
4147
const [submitStatus, setSubmitStatus] = useState<{ type: "success" | "error", message: string } | null>(null)
42-
const initialValues = useMemo(() => ({
48+
const initialValues = useMemo<ContactFormValues>(() => ({
4349
name: "",
4450
email: "",
4551
message: "",
@@ -70,7 +76,7 @@ export function ContactForm({ content, locale }: ContactFormProps) {
7076
useInitialValidation: false,
7177
initialValues,
7278
validate: validation,
73-
onSubmit: (values) => {
79+
onSubmit: (values: ContactFormValues) => {
7480
if (isSubmitting) return
7581

7682
setIsSubmitting(true)
@@ -115,7 +121,6 @@ export function ContactForm({ content, locale }: ContactFormProps) {
115121

116122
return (
117123
<div className="flex flex-col gap-4">
118-
<h1 className="text-4xl font-semibold text-white">{labels.heading}</h1>
119124
<div className="flex flex-col gap-2 mt-6">
120125
<TextInput
121126
placeholder={labels.namePlaceholder}
@@ -137,7 +142,7 @@ export function ContactForm({ content, locale }: ContactFormProps) {
137142
validate("email")
138143
}
139144
}}
140-
onBlur={(event) => {
145+
onBlur={(event: FocusEvent<HTMLInputElement>) => {
141146
const value = event.currentTarget.value?.trim()
142147
if (value && !emailValidation(value)) {
143148
validate("email")

src/components/forms/JobApplicationForm.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { AcceptTermsCheckbox } from "@/components/AcceptTermsCheckbox"
44
import type { AppLocale } from "@/lib/i18n"
55
import { Button, EmailInput, emailValidation, TextAreaInput, TextInput, useForm } from "@code0-tech/pictor"
6+
import type { FocusEvent } from "react"
67
import { useMemo, useState } from "react"
78
import { useWebHaptics } from "web-haptics/react"
89

@@ -23,6 +24,13 @@ interface JobApplicationFormProps {
2324
locale: AppLocale
2425
}
2526

27+
interface JobApplicationFormValues {
28+
name: string
29+
email: string
30+
text: string
31+
acceptTerms: boolean
32+
}
33+
2634
const defaultContent: JobApplicationFormContent = {
2735
applicationHeading: "Apply now",
2836
applicationNameLabel: "Name",
@@ -39,7 +47,7 @@ export function JobApplicationForm({ jobSlug, content, locale }: JobApplicationF
3947
const labels = { ...defaultContent, ...content }
4048
const [isSubmitting, setIsSubmitting] = useState(false)
4149
const [submitStatus, setSubmitStatus] = useState<{ type: "success" | "error", message: string } | null>(null)
42-
const initialValues = useMemo(() => ({
50+
const initialValues = useMemo<JobApplicationFormValues>(() => ({
4351
name: "",
4452
email: "",
4553
text: "",
@@ -70,7 +78,7 @@ export function JobApplicationForm({ jobSlug, content, locale }: JobApplicationF
7078
useInitialValidation: false,
7179
initialValues,
7280
validate: validation,
73-
onSubmit: (values) => {
81+
onSubmit: (values: JobApplicationFormValues) => {
7482
if (isSubmitting) return
7583

7684
setIsSubmitting(true)
@@ -137,7 +145,7 @@ export function JobApplicationForm({ jobSlug, content, locale }: JobApplicationF
137145
validate("email")
138146
}
139147
}}
140-
onBlur={(event) => {
148+
onBlur={(event: FocusEvent<HTMLInputElement>) => {
141149
const value = event.currentTarget.value?.trim()
142150
if (value && !emailValidation(value)) {
143151
validate("email")

0 commit comments

Comments
 (0)