feat: add contact form with Netlify integration and success/error messages

This commit is contained in:
ARC Developer
2025-07-10 20:31:49 +03:00
parent 27f3407175
commit d9ddffacb1
2 changed files with 37 additions and 1 deletions
+9 -1
View File
@@ -5,7 +5,15 @@ import Button from '~/components/ui/Button.astro';
const { inputs, textarea, disclaimer, button = 'İletişim', description = '' } = Astro.props; const { inputs, textarea, disclaimer, button = 'İletişim', description = '' } = Astro.props;
--- ---
<form> <form method="POST" data-netlify="true" name="contact-form" action="/iletisim?success=true" netlify-honeypot="bot-field">
<!-- Hidden honeypot field for spam protection -->
<div style="display: none;">
<label>
Don't fill this out if you're human:
<input name="bot-field" />
</label>
</div>
{ {
inputs && inputs &&
inputs.map( inputs.map(
+28
View File
@@ -7,9 +7,37 @@ import Features2 from '~/components/widgets/Features2.astro';
const metadata = { const metadata = {
title: '📡 İletişim - ARC YM1KTC', title: '📡 İletişim - ARC YM1KTC',
}; };
// Check for success/error parameters
const url = Astro.url;
const success = url.searchParams.get('success');
const error = url.searchParams.get('error');
--- ---
<Layout metadata={metadata}> <Layout metadata={metadata}>
<!-- Success/Error Messages -->
{success && (
<div class="bg-green-50 border border-green-200 text-green-800 px-4 py-3 rounded-lg mb-6 mx-6 mt-6">
<div class="flex items-center">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path>
</svg>
<strong>Başarılı!</strong> Mesajınız başarıyla gönderildi. En kısa sürede size dönüş yapacağız. 73!
</div>
</div>
)}
{error && (
<div class="bg-red-50 border border-red-200 text-red-800 px-4 py-3 rounded-lg mb-6 mx-6 mt-6">
<div class="flex items-center">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"></path>
</svg>
<strong>Hata!</strong> Mesaj gönderilirken bir sorun oluştu. Lütfen tekrar deneyin veya doğrudan e-posta gönderin.
</div>
</div>
)}
<!-- HeroText Widget ******************* --> <!-- HeroText Widget ******************* -->
<HeroText tagline="📡 İletişim" title="📻 73! Bizimle İletişime Geçin!" /> <HeroText tagline="📡 İletişim" title="📻 73! Bizimle İletişime Geçin!" />