package templates import ( "fmt" "github.com/haydenhargreaves/Potion/internal/domain/recipe" domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe" domainServer "github.com/haydenhargreaves/Potion/internal/domain/server" "github.com/haydenhargreaves/Potion/internal/templates/components" ) templ SearchPage(filters *domainRecipe.SearchFilters, searchOnLoad bool) { @components.Navbar("")
@components.BannerText("Recipe Search") @components.SearchBar(filters, false, searchOnLoad, false)
@ResultList(nil)
} templ ResultList(recipes []domain.Recipe) {
for _, recipe := range recipes { @searchResult(recipe) } if len(recipes) == 0 || recipes == nil {

No results

} else {

End of results

}
} templ searchResult(recipe domain.Recipe) {

{ recipe.Title }

@timeIconSm() { recipe.Duration.Total } min for _ = range(recipe.Difficulty) { @starIconSm(true) } for _ = range(5 - recipe.Difficulty) { @starIconSm(false) } @servingIconSm() Serves { recipe.Serves }

{ recipe.Description }

} templ servingIconSm() { } templ timeIconSm() { } templ starIconSm(filled bool) { if filled { } else { } }