diff --git a/src/contact/page-backup.tsx b/src/app/(main)/contact/page.tsx similarity index 100% rename from src/contact/page-backup.tsx rename to src/app/(main)/contact/page.tsx diff --git a/src/components/Blocks/Form/Button/index.tsx b/src/components/Blocks/Form/Button/index.tsx index 5fe2734..b9cb3e7 100644 --- a/src/components/Blocks/Form/Button/index.tsx +++ b/src/components/Blocks/Form/Button/index.tsx @@ -2,6 +2,7 @@ import type { ElementType } from "react"; import Link from "next/link"; import React from "react"; +import { CgSpinner } from "react-icons/cg"; export type Props = { appearance?: "default" | "primary" | "secondary"; @@ -12,6 +13,7 @@ export type Props = { label?: string; newTab?: boolean | null; onClick?: () => void; + isLoading?: boolean; }; export const Button: React.FC = ({ @@ -21,6 +23,7 @@ export const Button: React.FC = ({ href, label, newTab, + isLoading, }) => { const newTabProps = newTab ? { rel: "noopener noreferrer", target: "_blank" } : {}; const Element: ElementType = el; @@ -35,19 +38,21 @@ export const Button: React.FC = ({ const content = (
- {label} + + {label} {isLoading && } +
); return ( - + {(el === "link" || el === "a") && ( {content} )} - {el === "button" && content} + {el === "button" && <>{content}} ); diff --git a/src/components/Blocks/Form/index.tsx b/src/components/Blocks/Form/index.tsx index fa2195d..dca2329 100644 --- a/src/components/Blocks/Form/index.tsx +++ b/src/components/Blocks/Form/index.tsx @@ -76,7 +76,7 @@ export const FormBlock: React.FC< // delay loading indicator by 1s loadingTimerID = setTimeout(() => { setIsLoading(true); - }, 1000); + }, 250); try { const req = await fetch(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/form-submissions`, { @@ -160,7 +160,7 @@ export const FormBlock: React.FC< return null; })} -