db, handlers, and interfaces
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
package pages
|
||||
|
||||
import "michaelthomson.dev/mthomson/go-todos-app/templates/shared"
|
||||
import "michaelthomson.dev/mthomson/go-todos-app/db"
|
||||
import "michaelthomson.dev/mthomson/go-todos-app/templates/partials"
|
||||
import "michaelthomson.dev/mthomson/go-todos-app/models"
|
||||
|
||||
templ Home(todos []db.Todo) {
|
||||
templ Home(todos []models.Todo) {
|
||||
@shared.Page("Todos") {
|
||||
<div class="text-xl">Todos</div>
|
||||
<form hx-post="/todos" hx-target="#todos" hx-swap="beforeend">
|
||||
<input name="name" type="text" />
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
<div id="todos">
|
||||
<div class="flex content-center items-center flex-col">
|
||||
<h1 class="text-3xl">Todos</h1>
|
||||
<form hx-post="/todos" hx-target="#todos" hx-swap="beforeend">
|
||||
<input name="name" type="text" class="border border-black" />
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
<div id="todos">
|
||||
for _, todo := range todos {
|
||||
@partials.Todo(todo)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user