diff --git a/src/lib/components/LinkForm.svelte b/src/lib/components/LinkForm.svelte
index a8c761b..415c1d5 100644
--- a/src/lib/components/LinkForm.svelte
+++ b/src/lib/components/LinkForm.svelte
@@ -18,7 +18,7 @@
method="POST"
use:enhance
action="?/createLink"
- class="flex w-full max-w-sm items-center space-x-2"
+ class="flex w-full max-w-lg items-center justify-start space-x-4"
>
@@ -40,5 +40,5 @@
- Add
+ Add
diff --git a/src/lib/schemas/links.ts b/src/lib/schemas/links.ts
index 2855b3f..578cb55 100644
--- a/src/lib/schemas/links.ts
+++ b/src/lib/schemas/links.ts
@@ -2,7 +2,13 @@ import { z } from 'zod';
export const linksSchema = z.object({
title: z.string().min(1).max(50),
- url: z.string().min(10).max(200)
+ url: z
+ .string()
+ .min(10)
+ .max(200)
+ .refine((val) => val.startsWith('http://') || val.startsWith('https://'), {
+ message: 'Oops! URLs usually start with http:// or https:// :P'
+ })
});
export type LinksSchema = typeof linksSchema;