this repo has no description
1package frontend
2
3import (
4 "fmt"
5 "github.com/willdot/bskyfeedgen/store"
6)
7
8templ Subscriptions(errorMsg string, subscriptions []store.Subscription) {
9 @Base()
10 if errorMsg != "" {
11 <div role="alert">
12 <div class="border border-t-0 border-red-400 rounded-b bg-red-100 px-4 py-3 text-red-700">
13 <p>{ errorMsg }</p>
14 </div>
15 </div>
16 }
17 <section class="border-t border-t-zinc-200 mt-6 px-2 py-4 w-96">
18 <p>Subscriptions</p>
19 // LOOP THROUGH THE TODOS
20 <ul id="todo-list">
21 for _, sub := range subscriptions {
22 <li class="ml-4 ml-4 border p-2 rounded-lg mb-2" id={ fmt.Sprintf("sub%d", sub.ID) }>
23 <a class="font-medium text-sm" href={ templ.URL(sub.SubscribedPostURI) }>{ sub.SubscribedPostURI }</a>
24 <div class="flex gap-4 items-center mt-2">
25 <button
26 hx-delete={ fmt.Sprintf("/sub/%d", sub.ID) }
27 hx-swap="delete"
28 hx-target={ fmt.Sprintf("#sub%d", sub.ID) }
29 class="flex items-center border py-1 px-2 rounded-lg hover:bg-red-300"
30 >
31 <p class="text-sm">Delete</p>
32 </button>
33 </div>
34 </li>
35 }
36 </ul>
37 </section>
38}