diff options
| -rw-r--r-- | src/data/contactDetails.ts | 2 | ||||
| -rw-r--r-- | src/i18n/translations/pages/contact.ts | 36 | ||||
| -rw-r--r-- | src/pages/[locale]/contact.astro | 35 |
3 files changed, 73 insertions, 0 deletions
diff --git a/src/data/contactDetails.ts b/src/data/contactDetails.ts index 2357b6e..c12ed2f 100644 --- a/src/data/contactDetails.ts +++ b/src/data/contactDetails.ts @@ -1,5 +1,6 @@ export default { membershipSecretary: { + displayName: 'Membership Secretary', emailAddress: 'lallans@hotmail.co.uk', address: [ 'Scots Language Society', @@ -11,6 +12,7 @@ export default { ], }, generalEnquiries: { + displayName: 'General enquiries', emailAddress: 'lallans@hotmail.co.uk', address: [ 'Scots Language Society', diff --git a/src/i18n/translations/pages/contact.ts b/src/i18n/translations/pages/contact.ts new file mode 100644 index 0000000..7efc6f8 --- /dev/null +++ b/src/i18n/translations/pages/contact.ts @@ -0,0 +1,36 @@ +import type { TranslationsDictionary } from '$types/TranslationsDictionary'; + +const tContact = { + title: { + sco: () => 'Contact us', + 'en-GB': () => 'Contact us', + }, + 'submit-enquiry-online': { + sco: () => 'Submit enquiry online', + 'en-GB': () => 'Submit enquiry online', + }, + 'name-label': { + sco: () => 'Nem', + 'en-GB': () => 'Name', + }, + 'email-label': { + sco: () => 'Email', + 'en-GB': () => 'Email', + }, + 'subject-label': { + sco: () => 'Subject', + 'en-GB': () => 'Subject', + }, + 'message-body-label': { + sco: () => 'Message', + 'en-GB': () => 'Message', + }, + 'submit-button': { + sco: () => 'Submit', + 'en-GB': () => 'Submit', + }, +}; + +type Raw = typeof tContact; +export default tContact as TranslationsDictionary<Raw>; + diff --git a/src/pages/[locale]/contact.astro b/src/pages/[locale]/contact.astro new file mode 100644 index 0000000..653396b --- /dev/null +++ b/src/pages/[locale]/contact.astro @@ -0,0 +1,35 @@ +--- +import Page from '$layouts/Page.astro'; +import localeStaticPaths from '$lib/localeStaticPaths'; +import translate from '$i18n/translate'; +import tContact from '$i18n/translations/pages/contact'; +import type Locale from '$types/Locale'; + +export async function getStaticPaths() { + return localeStaticPaths; +} + +const locale = Astro.params.locale as Locale; +const t = translate(locale); +--- + +<Page title={(t(tContact, { key: 'title' }))}> + <h1>{ t(tContact, { key: 'title' }) }</h1> + + <h2>{ t(tContact, { key: 'submit-enquiry-online' }) }</h2> + <form method="post" action="/api/contact-form"> + <label for="name">{ t(tContact, { key: 'name-label' }) }</label> + <input id="name" type="text" name="name" required /> + + <label for="email">{ t(tContact, { key: 'email-label' }) }</label> + <input id="email" type="email" name="email" required /> + + <label for="subject">{ t(tContact, { key: 'subject-label' }) }</label> + <input id="subject" type="text" name="subject" required /> + + <label for="message">{ t(tContact, { key: 'message-body-label' }) }</label> + <textarea id="message" name="message" rows="3" cols="40" /> + + <button type="submit">{ t(tContact, { key: 'submit-button' }) }</button> + </form> +</Page> |
