diff --git a/src/lib/components/molecules/CustomDropdown.svelte b/src/lib/components/molecules/CustomDropdown.svelte new file mode 100644 index 0000000..26c8568 --- /dev/null +++ b/src/lib/components/molecules/CustomDropdown.svelte @@ -0,0 +1,51 @@ + + +
+
+ (open = true)} + on:blur={() => (open = false)} + /> + + {#if open} +
+ {#each options as option} +
+ +
+ {/each} +
+ {/if} +
+
diff --git a/src/routes/(app)/articles/createArticleDialog.svelte b/src/routes/(app)/articles/createArticleDialog.svelte index 462764f..c68baaa 100644 --- a/src/routes/(app)/articles/createArticleDialog.svelte +++ b/src/routes/(app)/articles/createArticleDialog.svelte @@ -1,16 +1,19 @@ @@ -65,39 +71,68 @@ > -
+
- Youtube video* + Youtube video link* - - - + span]:line-clamp-1' + )} + {...$$restProps} + let:builder + on:click + on:keydown + asChild={true} + > + +
+ + + +
+
+ {#each videos as video} + ($formData.video_id = 'https://youtu.be/' + video.snippet.resourceId.videoId)} value={video.snippet.resourceId.videoId} - label={video.snippet.title}>{video.snippet.title} + label={video.snippet.title} + >{video.snippet.title} + {/each}
+ +
- - +
+ +
+ -
+
Article length @@ -109,20 +144,15 @@ Short (~700 words) - Medium (~1500 words) - - - + + Long (~2500 words) - + @@ -133,7 +163,7 @@ -
+
Format diff --git a/src/routes/(app)/articles/schema.js b/src/routes/(app)/articles/schema.js index 98227fb..a7c44dc 100644 --- a/src/routes/(app)/articles/schema.js +++ b/src/routes/(app)/articles/schema.js @@ -1,7 +1,7 @@ import { z } from "zod"; export const createFormSchema = z.object({ - video_id: z.string(), + video_id: z.string().regex(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/, "Invalid Youtube URL"), // length: z.number().optional(), // format: z.enum(["summary", "listicle", "product review", "news report", "tutorial"]).optional(), });