{{ $form := .Page.Params.contactForm }}
<form class="max-w-lg mx-auto p-6 bg-white rounded shadow" method="POST" action="/contact">
	{{ range $form.fields }}
		<div class="mb-4">
			<label for="{{ .name }}" class="block text-gray-700 font-bold mb-2">{{ .label }}</label>
			{{ if eq .type "textarea" }}
				<textarea id="{{ .name }}" name="{{ .name }}" rows="5" {{ if .required }}required{{ end }} class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300"></textarea>
			{{ else }}
				<input type="{{ .type }}" id="{{ .name }}" name="{{ .name }}" {{ if .required }}required{{ end }} class="w-full px-3 py-2 border rounded focus:outline-none focus:ring focus:border-blue-300" />
			{{ end }}
		</div>
	{{ end }}
  <div class="flex justify-end mt-4">
    <button type="submit" class="px-6 py-3 rounded-lg font-bold transition duration-200 ease-in-out border-2 text-primary-400 border-primary-400 hover:border-primary-400 hover:text-primary-400 hover:scale-105">
      {{ $form.button.label | default "Envoyer" }}
    </button>
  </div>
</form>
