diff --git a/src/lib/en.json b/src/lib/en.json index 8e8ab53..a496a3f 100644 --- a/src/lib/en.json +++ b/src/lib/en.json @@ -49,6 +49,18 @@ "description": "Facts about sleep, background noise generator with the ability to share and select sounds from the community, dream log." } }, + "contact": { + "h": "Contact me", + "email": "Email", + "name": "Your name", + "message": "Message", + "submit": "Submit", + "submitted": "Message successfully sent!", + "errors": { + "required": "Required field", + "email": "Enter a valid email" + } + }, "footer": { "made_with": "Made with SvelteKit and Tailwind", "go_back": "Go back in time" diff --git a/src/lib/ru.json b/src/lib/ru.json index 2a7a1bc..e52ba72 100644 --- a/src/lib/ru.json +++ b/src/lib/ru.json @@ -54,7 +54,12 @@ "email": "Email", "name": "Ваше имя", "message": "Сообщение", - "submit": "Отправить" + "submit": "Отправить", + "submitted": "Сообщение успешно отправлено!", + "errors": { + "required": "Обязательное поле", + "email": "Введите валидный email" + } }, "footer": { "made_with": "Сделано с SvelteKit и Tailwind", diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 5fdc526..4188899 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -33,12 +33,12 @@ :global(input, textarea) { font-size: 18px; transition: border .3s; - @apply px-3 py-3 rounded-lg bg-slate-700 text-slate-400 border border-slate-500; + @apply px-3 py-3 rounded-lg bg-slate-950 text-slate-400 border border-slate-500; } :global(input:focus, textarea:focus) { outline: none; - border: 1px solid theme(colors.blue.500); + border: 1px solid theme(colors.slate.50); } :global(textarea) { diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 61789b9..6f93493 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -4,7 +4,7 @@ import About from "./About.svelte"; import Projects from "./Projects/Projects.svelte"; import Footer from "./Footer.svelte"; - // import ContactForm from "./ContactForm/ContactForm.svelte"; + import ContactForm from "./ContactForm/ContactForm.svelte"; export let data; @@ -14,6 +14,6 @@ - + diff --git a/src/routes/ContactForm/ContactForm.svelte b/src/routes/ContactForm/ContactForm.svelte index 15998bc..6c31851 100644 --- a/src/routes/ContactForm/ContactForm.svelte +++ b/src/routes/ContactForm/ContactForm.svelte @@ -1,5 +1,59 @@ - @@ -7,27 +61,59 @@ import {t} from "$lib/translations"; {$t('contact.h')} - + + + {$t('contact.message')} + + {#if attemptedSubmit && errorSlugs.message} + {$t(errorSlugs.message)} + {/if} + + - - {$t('contact.message')} - - - - - + {$t('contact.name')} - + + {#if attemptedSubmit && errorSlugs.name} + {$t(errorSlugs.name)} + {/if} - + {$t('contact.email')} - + + {#if attemptedSubmit && errorSlugs.email} + {$t(errorSlugs.email)} + {/if} + + {#if !submitted} + {$t('contact.submit')} + {:else} + {$t('contact.submitted')} + {/if} + - - {$t('contact.submit')} -