-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
demo: ingredient interface using templ
- Loading branch information
Showing
14 changed files
with
259 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
dev: | ||
npx tailwindcss -i ./tailwind.css -o ./static/tailwind.min.css --watch & | ||
air -- -debug | ||
|
||
prepare-db: backup | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package main | ||
|
||
//go:generate npx tailwindcss -i ./tailwind.css -o ./static/tailwind.min.css --minify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package components | ||
|
||
import "fmt" | ||
|
||
type SearchParams struct { | ||
URL string `json:"url"` | ||
Name string `json:"name"` | ||
Page int `json:"page"` | ||
PerPage int `json:"per_page"` | ||
} | ||
|
||
templ SearchBox(parameters SearchParams) { | ||
// method="GET" | ||
// if (parameters.URL != "") { | ||
// action={ templ.URL(parameters.URL) } | ||
// } | ||
<form | ||
class="flex flex-row gap-4 items-center my-4 md:my-8" | ||
method="GET" | ||
action="/admin/ingredients" | ||
hx-push-url="true" | ||
hx-boost="true" | ||
hx-trigger="input changed delay:100ms, search" | ||
hx-target="#page" | ||
hx-select="#page" | ||
hx-swap="outerHTML" | ||
> | ||
<label class="label" for="name"> | ||
Search | ||
<input class="input w-full" type="text" name="name" value={ parameters.Name }/> | ||
</label> | ||
<label class="label" for="page"> | ||
Page | ||
<input class="w-20 input" type="number" name="page" value={ fmt.Sprintf("%d", parameters.Page) }/> | ||
</label> | ||
<label class="label" for="perPage"> | ||
Per Page | ||
<input class="w-20 input" type="number" name="perPage" value={ fmt.Sprintf("%d", parameters.PerPage) }/> | ||
</label> | ||
<noscript> | ||
<input class="input" type="submit" value="Save"/> | ||
</noscript> | ||
</form> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
examples/simple-crud/templates/partials/recipes/recipe-card.partial.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.