diff --git a/src/components/ui/Form.astro b/src/components/ui/Form.astro index 276b39fd68..339102fefb 100644 --- a/src/components/ui/Form.astro +++ b/src/components/ui/Form.astro @@ -2,14 +2,30 @@ import type { Form as Props } from '~/types'; import Button from '~/components/ui/Button.astro'; -const { inputs, textarea, disclaimer, button = 'Contact us', description = '' } = Astro.props; +const { inputs, textarea, disclaimer, button = 'Contact us', description = '', form } = Astro.props; --- -
+ + + { inputs && inputs.map( - ({ type = 'text', name, label = '', autocomplete = 'on', placeholder = '' }) => + ({ type = 'text', name, label = '', autocomplete = 'on', placeholder = '', required }) => name && (
{label && ( @@ -23,6 +39,7 @@ const { inputs, textarea, disclaimer, button = 'Contact us', description = '' } id={name} autocomplete={autocomplete} placeholder={placeholder} + required={required} class="py-3 px-4 block w-full text-md rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-900" />
@@ -41,6 +58,7 @@ const { inputs, textarea, disclaimer, button = 'Contact us', description = '' } name={textarea.name ? textarea.name : 'message'} rows={textarea.rows ? textarea.rows : 4} placeholder={textarea.placeholder} + required={textarea.required} class="py-3 px-4 block w-full text-md rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-900" /> diff --git a/src/components/widgets/Contact.astro b/src/components/widgets/Contact.astro index 122f4b049d..b78898b361 100644 --- a/src/components/widgets/Contact.astro +++ b/src/components/widgets/Contact.astro @@ -13,6 +13,7 @@ const { disclaimer, button, description, + form, id, isDark = false, @@ -33,6 +34,7 @@ const { disclaimer={disclaimer} button={button} description={description} + form={form} /> ) diff --git a/src/pages/contact.astro b/src/pages/contact.astro index 70157e070d..b21db326d0 100644 --- a/src/pages/contact.astro +++ b/src/pages/contact.astro @@ -16,6 +16,13 @@ const metadata = {