1- import { CircleNotch , XCircle } from '@phosphor-icons/react' ;
2- import { AnyFormApi , FormApi , useForm } from '@tanstack/react-form' ;
1+ import { CircleNotch , PaperPlaneTilt , XCircle } from '@phosphor-icons/react' ;
2+ import { useForm } from '@tanstack/react-form' ;
33import { useSendEmail } from '@services/email/hooks/useSendEmail' ;
44import z from 'zod' ;
5- import { toast , Toaster } from 'sonner' ;
5+ import { toast } from 'sonner' ;
66import { CheckCircle } from '@phosphor-icons/react/dist/ssr' ;
77
88const contactFormSchema = z . object ( {
@@ -52,8 +52,8 @@ function ContactFormBlock() {
5252 }
5353
5454 return (
55- < div >
56- < h2 className = "text-2xl font-semibold text-gray-700 " > Contact us</ h2 >
55+ < div className = "card p-6" >
56+ < h2 className = "heading-color text-2xl font-semibold" > Contact us</ h2 >
5757 < form
5858 className = "flex gap-6 flex-col mt-6"
5959 onSubmit = { ( e ) => {
@@ -62,7 +62,7 @@ function ContactFormBlock() {
6262 } }
6363 >
6464 < div className = "flex gap-2 flex-col" >
65- < label className = "text-sm font-semibold text-zinc-800 " htmlFor = "name" >
65+ < label className = "form-label " htmlFor = "name" >
6666 Name
6767 </ label >
6868 < form . Field
@@ -74,11 +74,11 @@ function ContactFormBlock() {
7474 id = { fieldName . name }
7575 name = { fieldName . name }
7676 value = { fieldName . state . value }
77- className = "form-input border-gray-200 rounded-md "
77+ className = "form-input"
7878 onChange = { ( e ) => fieldName . handleChange ( e . target . value ) }
7979 />
8080 { ! fieldName . state . meta . isValid && (
81- < span className = "text-red-500 text-xs font-semibold" >
81+ < span className = "form-message-error text-xs font-semibold" >
8282 { fieldName . state . meta . errors [ 0 ] ?. message ?? '' }
8383 </ span >
8484 ) }
@@ -88,10 +88,7 @@ function ContactFormBlock() {
8888 </ div >
8989
9090 < div className = "flex gap-2 flex-col" >
91- < label
92- className = "text-sm font-semibold text-zinc-800"
93- htmlFor = "email"
94- >
91+ < label className = "form-label" htmlFor = "email" >
9592 Email
9693 </ label >
9794 < form . Field
@@ -103,11 +100,11 @@ function ContactFormBlock() {
103100 id = { fieldEmail . name }
104101 name = { fieldEmail . name }
105102 value = { fieldEmail . state . value }
106- className = "form-input border-gray-200 rounded-md "
103+ className = "form-input"
107104 onChange = { ( e ) => fieldEmail . handleChange ( e . target . value ) }
108105 />
109106 { ! fieldEmail . state . meta . isValid && (
110- < span className = "text-red-500 text-xs font-semibold " >
107+ < span className = "form-message-error " >
111108 { fieldEmail . state . meta . errors [ 0 ] ?. message ?? '' }
112109 </ span >
113110 ) }
@@ -117,10 +114,7 @@ function ContactFormBlock() {
117114 </ div >
118115
119116 < div className = "flex gap-2 flex-col" >
120- < label
121- className = "text-sm font-semibold text-zinc-800"
122- htmlFor = "email"
123- >
117+ < label className = "form-label" htmlFor = "email" >
124118 Message
125119 </ label >
126120 < form . Field
@@ -131,11 +125,11 @@ function ContactFormBlock() {
131125 id = { fieldMessage . name }
132126 name = { fieldMessage . name }
133127 value = { fieldMessage . state . value }
134- className = "form-input border-gray-200 rounded-md "
128+ className = "form-input"
135129 onChange = { ( e ) => fieldMessage . handleChange ( e . target . value ) }
136130 />
137131 { ! fieldMessage . state . meta . isValid && (
138- < span className = "text-red-500 text-xs font-semibold " >
132+ < span className = "form-message-error " >
139133 { fieldMessage . state . meta . errors [ 0 ] ?. message ?? '' }
140134 </ span >
141135 ) }
@@ -144,17 +138,13 @@ function ContactFormBlock() {
144138 />
145139 </ div >
146140
147- < button
148- className = "flex gap-4 items-center justify-center bg-zinc-900 text-white rounded-md px-4 py-2 hover:bg-zinc-800 transition-colors"
149- type = "submit"
150- >
151- Send message
141+ < button className = "form-submit" type = "submit" >
142+ Send message < PaperPlaneTilt weight = "duotone" />
152143 { status === 'pending' && (
153144 < CircleNotch size = { 18 } weight = "regular" className = "animate-spin" />
154145 ) }
155146 </ button >
156147 </ form >
157- < Toaster />
158148 </ div >
159149 ) ;
160150}
0 commit comments