Merge pull request 'fix: contact form section UI' (#14) from dev into main

Reviewed-on: #14
This commit is contained in:
RizqiSyahrendra 2025-04-28 22:32:29 +00:00
commit c7ddbed4b0
5 changed files with 42 additions and 17 deletions

View File

@ -3,6 +3,7 @@
import { FormBlock } from "@/components/blocks/Form"; import { FormBlock } from "@/components/blocks/Form";
import { useFormQuery } from "@/services/hooks/form"; import { useFormQuery } from "@/services/hooks/form";
import { useEffect } from "react"; import { useEffect } from "react";
import Loader from "./loaders/Loader";
export default function ContactFormSection() { export default function ContactFormSection() {
const form = useFormQuery(); const form = useFormQuery();
@ -13,12 +14,17 @@ export default function ContactFormSection() {
return ( return (
<div className="box-1-cell height-fill context-dark bg-colorContactForm! z-20!"> <div className="box-1-cell height-fill context-dark bg-colorContactForm! z-20!">
<div className="box-1-bg-shape"> {form.isFetching && (
<img className="box-1-bg-image" src="images/bg-shape-1.png" alt="" role="presentation" /> <div className="my-16">
</div> <Loader />
<div className="cell-inner box-1-outer"> </div>
<div className="box-1">{!form.isFetching && !!form.data && <FormBlock form={form.data} />}</div> )}
</div>
{!form.isFetching && (
<div className="cell-inner box-1-outer">
<div className="box-1">{!form.isFetching && !!form.data && <FormBlock form={form.data} />}</div>
</div>
)}
</div> </div>
); );
} }

View File

@ -23,11 +23,12 @@ export const Email: React.FC<
type="email" type="email"
className="form-input" className="form-input"
id={name} id={name}
placeholder={label}
{...register(name, { pattern: /^\S[^\s@]*@\S+$/, required: requiredFromProps })} {...register(name, { pattern: /^\S[^\s@]*@\S+$/, required: requiredFromProps })}
/> />
<label className="form-label" htmlFor={name}> {/* <label className="form-label" htmlFor={name}>
{label} {label}
</label> </label> */}
{requiredFromProps && errors[name] && <Error />} {requiredFromProps && errors[name] && <Error />}
</div> </div>
</Width> </Width>

View File

@ -19,10 +19,16 @@ export const Number: React.FC<
return ( return (
<Width width={width}> <Width width={width}>
<div className="form-wrap"> <div className="form-wrap">
<input type="number" className="form-input" id={name} {...register(name, { required: requiredFromProps })} /> <input
<label className="form-label" htmlFor={name}> type="number"
placeholder={label}
className="form-input"
id={name}
{...register(name, { required: requiredFromProps })}
/>
{/* <label className="form-label" htmlFor={name}>
{label} {label}
</label> </label> */}
{requiredFromProps && errors[name] && <Error />} {requiredFromProps && errors[name] && <Error />}
</div> </div>
</Width> </Width>

View File

@ -19,10 +19,16 @@ export const Text: React.FC<
return ( return (
<Width width={width}> <Width width={width}>
<div className="form-wrap"> <div className="form-wrap">
<input type="text" id={name} className="form-input" {...register(name, { required: requiredFromProps })} /> <input
<label className="form-label" htmlFor={name}> type="text"
id={name}
className="form-input"
placeholder={label}
{...register(name, { required: requiredFromProps })}
/>
{/* <label className="form-label" htmlFor={name}>
{label} {label}
</label> </label> */}
{requiredFromProps && errors[name] && <Error />} {requiredFromProps && errors[name] && <Error />}
</div> </div>
</Width> </Width>

View File

@ -20,10 +20,16 @@ export const Textarea: React.FC<
return ( return (
<Width width={width}> <Width width={width}>
<div className="form-wrap"> <div className="form-wrap">
<textarea className="form-input" id={name} rows={rows} {...register(name, { required: requiredFromProps })} /> <textarea
<label className="form-label" htmlFor={name}> className="form-input"
id={name}
rows={rows}
placeholder={label}
{...register(name, { required: requiredFromProps })}
/>
{/* <label className="form-label" htmlFor={name}>
{label} {label}
</label> </label> */}
{requiredFromProps && errors[name] && <Error />} {requiredFromProps && errors[name] && <Error />}
</div> </div>
</Width> </Width>