+) {
+ if (req.method === "POST") {
+ const body = req.body as RequestMailProps;
+
+ let transporter = nodemailer.createTransport({
+ host: process.env.SMTP_HOST,
+ port: 587,
+ secure: false, // true for 465, false for other ports
+ auth: {
+ user: process.env.SMTP_USER,
+ pass: process.env.SMTP_PASSWORD,
+ },
+ });
+
+ // send mail with defined transport object
+ let info = await transporter
+ .sendMail({
+ from: `"${body.name}" <${body.email}>`,
+ to: "contact@accords-library.com",
+ subject: `New ${body.formName} from ${body.name}`,
+ text: body.message,
+ })
+ .catch((reason: SMTPError) => {
+ res.status(reason.responseCode || 500).json({
+ code: reason.code,
+ message: reason.response,
+ });
+ });
+ }
+
+ res.status(200).json({ code: "OKAY" });
+}
diff --git a/src/pages/editor.tsx b/src/pages/editor.tsx
index b770c0e..9859fe5 100644
--- a/src/pages/editor.tsx
+++ b/src/pages/editor.tsx
@@ -72,7 +72,7 @@ export default function Editor(props: EditorProps): JSX.Element {
target.select();
event.preventDefault();
}}
- className="bg-mid rounded-xl p-8 w-full font-monospace"
+ className="font-monospace"
/>
diff --git a/src/queries/helpers.ts b/src/queries/helpers.ts
index 7393aa1..9b938c5 100644
--- a/src/queries/helpers.ts
+++ b/src/queries/helpers.ts
@@ -291,3 +291,7 @@ export function slugify(string: string | undefined): string {
.replace(/ /gi, "-")
.toLowerCase();
}
+
+export function randomInt(min: number, max: number) {
+ return Math.floor(Math.random() * (max - min)) + min;
+}
diff --git a/src/tailwind.css b/src/tailwind.css
index 80f03cd..e13be31 100644
--- a/src/tailwind.css
+++ b/src/tailwind.css
@@ -136,16 +136,26 @@
/* INPUT */
- input {
- @apply rounded-full p-2 text-center bg-light outline outline-mid outline-2 outline-offset-[-2px] hover:outline-[transparent] text-dark hover:bg-mid transition-all;
+ input,
+ textarea {
+ @apply rounded-full p-2 text-center bg-light outline outline-mid outline-2 outline-offset-[-2px] hover:outline-[transparent] text-dark hover:bg-mid transition-all placeholder:text-dark placeholder:opacity-60;
}
input::placeholder {
@apply text-dark opacity-60;
}
- input:focus-visible {
- @apply outline-none bg-mid shadow-inner-sm;
+ input:focus-visible,
+ textarea:focus-within {
+ @apply outline-none bg-mid shadow-inner-sm shadow-shade;
+ }
+
+ textarea {
+ @apply rounded-2xl text-left p-6;
+ }
+
+ input[type="submit"] {
+ @apply grid place-content-center place-items-center border-[1px] border-dark text-dark rounded-full px-4 pt-[0.4rem] pb-[0.5rem] transition-all cursor-pointer hover:text-light hover:bg-dark hover:drop-shadow-shade-lg active:bg-black active:text-light active:drop-shadow-black-lg active:border-black;
}
}