import React from 'react';
import { Head, Link, useForm, usePage } from '@inertiajs/react';
import { useTranslation } from 'react-i18next';
import { useLocalizedRoutes } from '@/hooks/useLocalizedRoutes';
import MarketingLayout from '@/layouts/mainWebsite';
const Kontakt: React.FC = () => {
const { data, setData, post, processing, errors, reset } = useForm({
name: '',
email: '',
message: '',
});
const { flash } = usePage().props as any;
const { t } = useTranslation('marketing');
const { localizedPath } = useLocalizedRoutes();
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
post(localizedPath('/kontakt'), {
onSuccess: () => reset(),
});
};
React.useEffect(() => {
if (Object.keys(errors).length > 0) {
window.scrollTo({ top: 0, behavior: 'smooth' });
}
}, [errors]);
return (
{t('kontakt.description')}
{flash?.success &&{flash.success}
} {Object.keys(errors).length > 0 && (