You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.5 KiB

<script>
import { variables } from "$lib/helpers/variables";
let email = "";
let message = "";
let notify;
function send() {
email = "";
message = "";
notify = "Email sent!";
}
</script>
<main class="flex flex-col gap-5 w-2/3 mx-auto">
<form
class="flex flex-col gap-5"
action="https://api.staticforms.xyz/submit"
method="post"
>
<input
type="hidden"
name="accessKey"
value="534c3443-4fa9-41bc-976b-684b3049bef3"
/>
<input type="text" name="honeypot" style="display: none;" />
<input type="hidden" name="redirectTo" value={variables.appUrl} />
<div class="flex flex-col">
<label for="email" value="E-Mail" class="text-lg font-bold"
>E-Mail</label
>
<input
id="email"
name="email"
type="text"
class="text-lg py-1 px-2 rounded-lg shadow bg-gray-600"
bind:value={email}
/>
</div>
<div class="flex flex-col">
<label for="message" value="E-Mail" class="text-lg font-bold"
>Message</label
>
<textarea
id="message"
name="message"
class="text-lg py-1 px-2 rounded-lg shadow bg-gray-600"
bind:value={message}
rows="5"
/>
</div>
<div class="flex flex-col">
{#if email != "" && message != ""}
<button
type="submit"
on:click={send}
class="bg-gradient-to-tr from-red-500 to-pink-500 py-2 px-3 rounded-lg font-bold shadow button"
>Send</button
>
{:else}
<button
disabled
type="none"
on:click={send}
title="Fill in the fields before submitting"
class="bg-black bg-opacity-50 py-2 px-3 rounded-lg font-bold shadow text-gray-400"
>
Send
</button>
{/if}
</div>
{#if notify}
<p class="text-green-500 font-bold text-lg">{notify}</p>
{/if}
</form>
</main>
<style>
.button {
transition-duration: 0.3s;
}
.button:hover {
transition-duration: 0.3s;
transform: translateY(-2px);
}
.button:active {
transition-duration: 0.3s;
transform: translateY(5px);
}
</style>