1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/** @jsx jsx */
/** @jsxFrag Fragment */
import { jsx, Fragment } from 'https://deno.land/x/hono/middleware.ts'
export default function EditLinkModal({ username, linkId, label, url }) {
return (
<div id="edit-link-modal" className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50">
<div className="bg-white rounded-lg shadow-xl p-8 w-full max-w-md mx-4 mt-4 mb-0">
<h2 className="text-xl font-bold mb-4">Edit Link</h2>
<form action={`/links/${linkId}`} method="put" className="space-y-4" hx-push-url={`/edit-profile/${username}`}>
<input
type="text"
name="label"
value={label}
placeholder="Link Label"
className="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
<input
type="text"
name="url"
value={url}
placeholder="Link URL"
className="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
<button
type="submit"
className="w-full bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded"
>
Update
</button>
<button
type="button"
className="w-full bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded"
hx-delete={`/links/${linkId}`}
hx-target="body"
>
Delete
</button>
</form>
<button
className="w-full bg-gray-500 hover:bg-gray-600 text-white font-bold py-2 px-4 rounded"
onclick={"event.preventDefault(); document.getElementById('edit-link-modal').style.display='none';"}
>
Cancel
</button>
</div>
</div>
);
}