|
6 | 6 | import { tagOptions } from '$lib/services/tags'; |
7 | 7 | import type { ProjectT } from '$lib/types/types'; |
8 | 8 | import { onMount } from 'svelte'; |
| 9 | + import Modal from '$lib/components/project/Modal.svelte'; |
9 | 10 |
|
10 | 11 | let allProjects: ProjectT[] = []; |
| 12 | + let openIndex = -1; |
11 | 13 |
|
12 | 14 | let project: ProjectT = { |
13 | 15 | title: '', |
|
17 | 19 | featured: false, |
18 | 20 | priority: 10, |
19 | 21 | tags: [], |
20 | | - media: [] |
| 22 | + media: [''] |
21 | 23 | }; |
22 | 24 |
|
23 | 25 | let tag: string = ''; |
|
26 | 28 | async function submit() { |
27 | 29 | banner.show('Submitting', 'info'); |
28 | 30 |
|
| 31 | + project.media = project.media.filter((l) => l !== ''); |
| 32 | +
|
29 | 33 | if (project.title === '') return banner.show('No Title', 'error'); |
30 | 34 | if (project.description === '') return banner.show('No Description', 'error'); |
31 | 35 | if (project.media.length === 0) return banner.show('No Image Url', 'error'); |
|
72 | 76 | </script> |
73 | 77 |
|
74 | 78 | <section> |
| 79 | + <Modal projectsList={[project]} projectIndex={openIndex} /> |
| 80 | + |
75 | 81 | <div class="row"> |
76 | 82 | <div class="column demo"> |
77 | 83 | <h2>Search project</h2> |
|
90 | 96 |
|
91 | 97 | <div class="center"> |
92 | 98 | <div class="tiles"> |
93 | | - <Tile cardData={project} /> |
| 99 | + <Tile cardData={project} index={0} bind:openIndex /> |
94 | 100 | </div> |
95 | 101 | </div> |
96 | 102 | </div> |
|
103 | 109 | <input type="text" id="title" name="title" bind:value={project.title} /> |
104 | 110 | </div> |
105 | 111 |
|
106 | | - <div class="field"> |
107 | | - <label for="tldr">TLDR</label> |
108 | | - <textarea id="tldr" name="tldr" rows="3" bind:value={project.tldr} /> |
109 | | - </div> |
110 | | - |
111 | 112 | <div class="field"> |
112 | 113 | <label for="description">Description</label> |
113 | 114 | <textarea id="description" name="description" rows="7" bind:value={project.description} /> |
|
116 | 117 | <h3>Optional</h3> |
117 | 118 |
|
118 | 119 | <div class="field"> |
119 | | - <label for="followUrl">Follow Url</label> |
120 | | - <input type="text" id="followUrl" name="followUrl" bind:value={project.followUrl} /> |
| 120 | + <label for="tldr">TLDR</label> |
| 121 | + <textarea id="tldr" name="tldr" rows="3" bind:value={project.tldr} /> |
121 | 122 | </div> |
122 | 123 |
|
123 | 124 | <div class="field"> |
| 125 | + <label for="followUrl">Follow Url</label> |
| 126 | + <input type="text" id="followUrl" name="followUrl" bind:value={project.followUrl} /> |
124 | 127 | <label for="featured">Featured</label> |
125 | 128 | <input type="checkbox" id="featured" name="featured" bind:checked={project.featured} /> |
126 | 129 | </div> |
127 | 130 |
|
128 | 131 | <div class="field"> |
129 | 132 | <label for="priority">Priority</label> |
130 | 133 | <input type="number" id="priority" name="priority" bind:value={project.priority} /> |
131 | | - </div> |
132 | | - |
133 | | - <div class="field"> |
134 | 134 | <label for="tags">tags</label> |
135 | 135 | <select name="tags" id="tags" bind:value={tag} on:change={addTag}> |
136 | 136 | {#each tagOptions as tagOptionItem} |
|
153 | 153 | {/if} |
154 | 154 |
|
155 | 155 | <div class="extra-media"> |
156 | | - <h3>Extra Media</h3> |
| 156 | + <h3>Media URLs</h3> |
157 | 157 | {#each project.media as link} |
158 | 158 | <div class="field"> |
159 | 159 | <input type="text" id="media" name="media" bind:value={link} /> |
|
0 commit comments