Compare commits
2 Commits
c0fc47c569
...
9ac7356668
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ac7356668 | ||
|
|
d950e75540 |
@ -42,7 +42,7 @@ func GoogleCallback(ctx *gin.Context) {
|
|||||||
jwt,
|
jwt,
|
||||||
int(time.Now().Add(7*24*time.Hour).Sub(time.Now()).Seconds()),
|
int(time.Now().Add(7*24*time.Hour).Sub(time.Now()).Seconds()),
|
||||||
"/",
|
"/",
|
||||||
"localhost",
|
"", // TODO: Real live domain
|
||||||
false, // TODO: True in prod
|
false, // TODO: True in prod
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
@ -60,6 +60,6 @@ func GoogleCallback(ctx *gin.Context) {
|
|||||||
// This route will direct the user back to the home page.
|
// This route will direct the user back to the home page.
|
||||||
func Logout(ctx *gin.Context) {
|
func Logout(ctx *gin.Context) {
|
||||||
// TODO: Use same values as the GoogleCallback function
|
// TODO: Use same values as the GoogleCallback function
|
||||||
ctx.SetCookie("jwt_token", "", -1, "/", "localhost", false, true)
|
ctx.SetCookie("jwt_token", "", -1, "/", "", false, true) // TODO: Update settings
|
||||||
ctx.Redirect(http.StatusSeeOther, domain.WEB_HOME)
|
ctx.Redirect(http.StatusSeeOther, domain.WEB_HOME)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,15 @@
|
|||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/a-h/templ"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
domain "github.com/haydenhargreaves/Potion/internal/domain/server"
|
domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
domainServer "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
layouts "github.com/haydenhargreaves/Potion/internal/templates/layouts"
|
layouts "github.com/haydenhargreaves/Potion/internal/templates/layouts"
|
||||||
pages "github.com/haydenhargreaves/Potion/internal/templates/pages"
|
pages "github.com/haydenhargreaves/Potion/internal/templates/pages"
|
||||||
)
|
)
|
||||||
@ -34,8 +37,8 @@ func FavoritesPage(ctx *gin.Context) {
|
|||||||
|
|
||||||
func CreatePage(ctx *gin.Context) {
|
func CreatePage(ctx *gin.Context) {
|
||||||
// If not logged in, direct to the login page
|
// If not logged in, direct to the login page
|
||||||
if !domain.IsLoggedIn(ctx) {
|
if !domainServer.IsLoggedIn(ctx) {
|
||||||
ctx.Redirect(http.StatusSeeOther, domain.WEB_LOGIN)
|
ctx.Redirect(http.StatusSeeOther, domainServer.WEB_LOGIN)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,13 +50,13 @@ func CreatePage(ctx *gin.Context) {
|
|||||||
|
|
||||||
func ProfilePage(ctx *gin.Context) {
|
func ProfilePage(ctx *gin.Context) {
|
||||||
// If not logged in, direct to the login page
|
// If not logged in, direct to the login page
|
||||||
if !domain.IsLoggedIn(ctx) {
|
if !domainServer.IsLoggedIn(ctx) {
|
||||||
ctx.Redirect(http.StatusSeeOther, domain.WEB_LOGIN)
|
ctx.Redirect(http.StatusSeeOther, domainServer.WEB_LOGIN)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Else, get the user data
|
// Else, get the user data
|
||||||
deps := ctx.MustGet("deps").(*domain.InjectedDependencies)
|
deps := ctx.MustGet("deps").(*domainServer.InjectedDependencies)
|
||||||
user := deps.UserService.GetAuthenicatedUser(ctx)
|
user := deps.UserService.GetAuthenicatedUser(ctx)
|
||||||
|
|
||||||
title := "Potion - Profile"
|
title := "Potion - Profile"
|
||||||
@ -72,7 +75,7 @@ func ListPage(ctx *gin.Context) {
|
|||||||
// TODO: Figure out how to handle errors, think we just need a simple display.
|
// TODO: Figure out how to handle errors, think we just need a simple display.
|
||||||
func RecipePage(ctx *gin.Context) {
|
func RecipePage(ctx *gin.Context) {
|
||||||
// Call recipe service to get via ID
|
// Call recipe service to get via ID
|
||||||
deps := ctx.MustGet("deps").(*domain.InjectedDependencies)
|
deps := ctx.MustGet("deps").(*domainServer.InjectedDependencies)
|
||||||
id := ctx.Param("id")
|
id := ctx.Param("id")
|
||||||
|
|
||||||
// Parse ID
|
// Parse ID
|
||||||
@ -106,10 +109,22 @@ func RecipePage(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SearchPage(ctx *gin.Context) {
|
func SearchPage(ctx *gin.Context) {
|
||||||
title := "Potion - Recipe Search"
|
var page templ.Component
|
||||||
page := pages.SearchPage()
|
// Get filters from cookies
|
||||||
|
if bytes, err := ctx.Cookie("search-filters"); err != nil {
|
||||||
|
fmt.Printf("ERROR: Failed to get search-filter cookie. %s\n", err.Error())
|
||||||
|
page = pages.SearchPage(domainRecipe.SearchFilters{})
|
||||||
|
} else {
|
||||||
|
var filters domainRecipe.SearchFilters
|
||||||
|
if err := json.Unmarshal([]byte(bytes), &filters); err != nil {
|
||||||
|
fmt.Printf("ERROR: Failed to unmarshal search-filter cookie. %s\n", err.Error())
|
||||||
|
page = pages.SearchPage(domainRecipe.SearchFilters{})
|
||||||
|
} else {
|
||||||
|
page = pages.SearchPage(filters)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Println("I OPENED A PAGE!")
|
title := "Potion - Recipe Search"
|
||||||
|
|
||||||
ctx.HTML(http.StatusOK, "", layouts.AppLayout(title, page))
|
ctx.HTML(http.StatusOK, "", layouts.AppLayout(title, page))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
domain "github.com/haydenhargreaves/Potion/internal/domain/server"
|
domain "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
templates "github.com/haydenhargreaves/Potion/internal/templates/pages"
|
templates "github.com/haydenhargreaves/Potion/internal/templates/pages"
|
||||||
)
|
)
|
||||||
@ -30,10 +34,50 @@ func CreateRecipe(ctx *gin.Context) {
|
|||||||
ctx.Status(http.StatusCreated)
|
ctx.Status(http.StatusCreated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// toBits converts an array of stringified numbers into a single summed value
|
||||||
|
func toBits(arr []string) (bits int) {
|
||||||
|
for _, x := range arr {
|
||||||
|
num, _ := strconv.Atoi(x)
|
||||||
|
bits += num
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: I don't love doing all of this here, but it seems to be the only way to get it to work...
|
||||||
func SearchRecipes(ctx *gin.Context) {
|
func SearchRecipes(ctx *gin.Context) {
|
||||||
deps := ctx.MustGet("deps").(*domain.InjectedDependencies)
|
deps := ctx.MustGet("deps").(*domain.InjectedDependencies)
|
||||||
|
|
||||||
recipes, err := deps.RecipeService.SearchRecipes(ctx)
|
|
||||||
|
// create filters
|
||||||
|
filters := domainRecipe.SearchFilters{
|
||||||
|
Search: ctx.PostForm("search"), // string, search query for titles
|
||||||
|
MealType: toBits(ctx.PostFormArray("meal")),
|
||||||
|
Time: toBits(ctx.PostFormArray("time")),
|
||||||
|
Difficulty: toBits(ctx.PostFormArray("difficulty")),
|
||||||
|
ServingSize: toBits(ctx.PostFormArray("serving")),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the filters into the cookies, so they can be reloaded
|
||||||
|
if bytes, err := json.Marshal(filters); err == nil {
|
||||||
|
ctx.SetCookie(
|
||||||
|
"search-filters",
|
||||||
|
string(bytes),
|
||||||
|
int(time.Now().Add(24 * time.Hour).Sub(time.Now()).Seconds()),
|
||||||
|
"/",
|
||||||
|
"", // TODO: Need an actual domain
|
||||||
|
false, // TODO: True in prod
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
redirect := ctx.PostForm("redirect")
|
||||||
|
if redirect == "true" {
|
||||||
|
ctx.Header("HX-Redirect", domain.WEB_SEARCH)
|
||||||
|
ctx.Status(http.StatusOK)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
recipes, err := deps.RecipeService.SearchRecipes(filters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.JSON(http.StatusOK, gin.H{"error": err.Error()})
|
ctx.JSON(http.StatusOK, gin.H{"error": err.Error()})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,11 +6,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
domain "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
const TAG_HTML = `
|
const TAG_HTML = `
|
||||||
<li
|
<li
|
||||||
hx-post="/v1/web/state/tags/delete"
|
hx-post="%s"
|
||||||
hx-trigger="click"
|
hx-trigger="click"
|
||||||
hx-target="#tag-list"
|
hx-target="#tag-list"
|
||||||
hx-swap="innerHTML"
|
hx-swap="innerHTML"
|
||||||
@ -41,7 +42,7 @@ func NewTag(ctx *gin.Context) {
|
|||||||
var cleaned_tags []string
|
var cleaned_tags []string
|
||||||
for _, tag := range tags {
|
for _, tag := range tags {
|
||||||
if tag != "" {
|
if tag != "" {
|
||||||
html += fmt.Sprintf(TAG_HTML, tag, tag)
|
html += fmt.Sprintf(TAG_HTML, domain.STATE_TAGS_DELETE, tag, tag)
|
||||||
|
|
||||||
// Ensure that the list provided does not contain blank spaces.
|
// Ensure that the list provided does not contain blank spaces.
|
||||||
// This is another measure to ensure this state is bulletproof.
|
// This is another measure to ensure this state is bulletproof.
|
||||||
@ -63,7 +64,7 @@ func DeleteTag(ctx *gin.Context) {
|
|||||||
var new_tags []string
|
var new_tags []string
|
||||||
for _, tag := range tags {
|
for _, tag := range tags {
|
||||||
if tag != target && tag != "" {
|
if tag != target && tag != "" {
|
||||||
html += fmt.Sprintf(TAG_HTML, tag, tag)
|
html += fmt.Sprintf(TAG_HTML, domain.STATE_TAGS_DELETE ,tag, tag)
|
||||||
new_tags = append(new_tags, tag)
|
new_tags = append(new_tags, tag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,9 +98,11 @@ func (s *AuthService) GoogleAuthSuccess(state, code string) (string, domain.User
|
|||||||
|
|
||||||
jwt, err := generateJwt(newUser.Id, newUser.Email, s.jwtSecret)
|
jwt, err := generateJwt(newUser.Id, newUser.Email, s.jwtSecret)
|
||||||
return jwt, newUser, googleUserInfo, err
|
return jwt, newUser, googleUserInfo, err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generateJwt requires user data and returns a JSON web token which can be stored in the browsers
|
||||||
|
// cookies. This token is used to log a user into the application and allow access to protected
|
||||||
|
// routes.
|
||||||
func generateJwt(userId int, email string, jwtSecret []byte) (string, error) {
|
func generateJwt(userId int, email string, jwtSecret []byte) (string, error) {
|
||||||
expiration := time.Now().Add(7 * 24 * time.Hour)
|
expiration := time.Now().Add(7 * 24 * time.Hour)
|
||||||
|
|
||||||
|
|||||||
@ -130,46 +130,20 @@ func (s *RecipeService) GetRecipe(id int) (*domain.Recipe, error) {
|
|||||||
return recipe, err
|
return recipe, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// toBits converts an array of stringified numbers into a single summed value
|
// SearchRecipes will search the database using the filters provided. The recipes can be passed into
|
||||||
func toBits(arr []string) (bits int) {
|
// a template and displayed in the UI as the search result. A more detailed definition of the
|
||||||
for _, x := range arr {
|
// filters is provided below.
|
||||||
num, _ := strconv.Atoi(x)
|
//
|
||||||
bits += num
|
// Each input is given a bit value (e.g., 00001 for 1) and will be passed
|
||||||
}
|
// back to this handler as an array. The values are then added together
|
||||||
return
|
// and will result in a integer which represents bit values. These bits
|
||||||
}
|
// can then be passed to the repository and are then parsed to determine
|
||||||
|
// which filters should be applied.
|
||||||
// isBitActive returns true when the bit at pos (0 indexed) is true.
|
// Parsing these is simple, for each filter option, use the bitwise and (&)
|
||||||
func isBitActive(bits, pos int) bool {
|
// operator with the value we expect for the filter. When 1, we can ensure
|
||||||
return (bits>>pos)&1 == 1
|
// the filter is provided.
|
||||||
}
|
// A function `isBitActive` in the recipe repository provides an example of
|
||||||
|
// testing of testing the filter parsing.
|
||||||
func (s *RecipeService) SearchRecipes(ctx *gin.Context) ([]domain.Recipe, error) {
|
func (s *RecipeService) SearchRecipes(filters domain.SearchFilters) ([]domain.Recipe, error) {
|
||||||
// NOTE: How are the filters handled?
|
|
||||||
// Each input is given a bit value (e.g., 00001 for 1) and will be passed
|
|
||||||
// back to this handler as an array. The values are then added together
|
|
||||||
// and will result in a integer which represents bit values. These bits
|
|
||||||
// can then be passed to the repository and are then parsed to determine
|
|
||||||
// which filters should be applied.
|
|
||||||
// Parsing these is simple, for each filter option, use the bitwise and (&)
|
|
||||||
// operator with the value we expect for the filter. When 1, we can ensure
|
|
||||||
// the filter is provided.
|
|
||||||
// A function above (isBitActive) provides an example of testing of testing
|
|
||||||
// the filter parsing.
|
|
||||||
|
|
||||||
search := ctx.PostForm("search") // string, search query for titles
|
|
||||||
meal := toBits(ctx.PostFormArray("meal"))
|
|
||||||
time := toBits(ctx.PostFormArray("time"))
|
|
||||||
difficulty := toBits(ctx.PostFormArray("difficulty"))
|
|
||||||
serving := toBits(ctx.PostFormArray("serving"))
|
|
||||||
|
|
||||||
filters := domain.SearchFilters{
|
|
||||||
Search: search,
|
|
||||||
MealType: meal,
|
|
||||||
Time: time,
|
|
||||||
Difficulty: difficulty,
|
|
||||||
ServingSize: serving,
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.recipeRepository.SearchRecipes(filters)
|
return s.recipeRepository.SearchRecipes(filters)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,5 +5,5 @@ import "github.com/gin-gonic/gin"
|
|||||||
type RecipeService interface {
|
type RecipeService interface {
|
||||||
CreateRecipe(ctx *gin.Context) (*Recipe, error)
|
CreateRecipe(ctx *gin.Context) (*Recipe, error)
|
||||||
GetRecipe(id int) (*Recipe, error)
|
GetRecipe(id int) (*Recipe, error)
|
||||||
SearchRecipes(ctx *gin.Context) ([]Recipe, error)
|
SearchRecipes(filters SearchFilters) ([]Recipe, error)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ package domain
|
|||||||
const VERSION = "/v1"
|
const VERSION = "/v1"
|
||||||
const WEB = "/web"
|
const WEB = "/web"
|
||||||
const API = "/api"
|
const API = "/api"
|
||||||
|
const STATE = "/state"
|
||||||
|
|
||||||
// Web prefixed routes
|
// Web prefixed routes
|
||||||
const WEB_LOGIN = VERSION + WEB + "/login"
|
const WEB_LOGIN = VERSION + WEB + "/login"
|
||||||
@ -14,6 +15,7 @@ const WEB_CREATE = VERSION + WEB + "/create"
|
|||||||
const WEB_PROFIlE = VERSION + WEB + "/profile"
|
const WEB_PROFIlE = VERSION + WEB + "/profile"
|
||||||
const WEB_LIST = VERSION + WEB + "/list"
|
const WEB_LIST = VERSION + WEB + "/list"
|
||||||
const WEB_RECIPE = VERSION + WEB + "/recipe/%d"
|
const WEB_RECIPE = VERSION + WEB + "/recipe/%d"
|
||||||
|
const WEB_SEARCH = VERSION + WEB + "/search"
|
||||||
|
|
||||||
// API prefixed routes
|
// API prefixed routes
|
||||||
const API_AUTH_LOGIN = VERSION + API + "/auth/login"
|
const API_AUTH_LOGIN = VERSION + API + "/auth/login"
|
||||||
@ -21,3 +23,7 @@ const API_AUTH_CALLBACK = VERSION + API + "/auth/callback"
|
|||||||
const API_AUTH_LOGOUT = VERSION + API + "/auth/logout"
|
const API_AUTH_LOGOUT = VERSION + API + "/auth/logout"
|
||||||
const API_CREATE_RECIPE = VERSION + API + "/recipe"
|
const API_CREATE_RECIPE = VERSION + API + "/recipe"
|
||||||
const API_SEARCH_RECIPES = VERSION + API + "/recipe/search"
|
const API_SEARCH_RECIPES = VERSION + API + "/recipe/search"
|
||||||
|
|
||||||
|
// State prefixed routes
|
||||||
|
const STATE_TAGS_CREATE = VERSION + WEB + STATE + "/tags"
|
||||||
|
const STATE_TAGS_DELETE = VERSION + WEB + STATE + "/tags/delete"
|
||||||
|
|||||||
@ -8,12 +8,16 @@ import (
|
|||||||
domainUser "github.com/haydenhargreaves/Potion/internal/domain/user"
|
domainUser "github.com/haydenhargreaves/Potion/internal/domain/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// InjectedDependencies is a collection of dependencies that are injected into the application. They
|
||||||
|
// are stored in the context and can be accessed by handlers via the context.
|
||||||
type InjectedDependencies struct {
|
type InjectedDependencies struct {
|
||||||
UserService domainUser.UserService
|
UserService domainUser.UserService
|
||||||
AuthService domainAuth.AuthService
|
AuthService domainAuth.AuthService
|
||||||
RecipeService domainRecipe.RecipeService
|
RecipeService domainRecipe.RecipeService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JwtClaims is the data stored in the JSON web token. All that is needed is the users ID and their
|
||||||
|
// Google email provided.
|
||||||
type JwtClaims struct {
|
type JwtClaims struct {
|
||||||
UserId int `json:"id"`
|
UserId int `json:"id"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
|
|||||||
@ -159,6 +159,12 @@ func isBitActive(bits, pos int) bool {
|
|||||||
return (bits>>pos)&1 == 1
|
return (bits>>pos)&1 == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SearchRecipes will search the recipe table using the provided filters and return an unbound list
|
||||||
|
// of recipes. The filters are fairly complex, they are stored as bit masks. A more details
|
||||||
|
// description can be found in the recipe service implementation. Any errors will be bubbled to the
|
||||||
|
// caller.
|
||||||
|
//
|
||||||
|
// TODO: Pagination is required, to provide infinite scroll.
|
||||||
func (r *RecipeRepository) SearchRecipes(filters domain.SearchFilters) ([]domain.Recipe, error) {
|
func (r *RecipeRepository) SearchRecipes(filters domain.SearchFilters) ([]domain.Recipe, error) {
|
||||||
tx, err := r.db.Begin()
|
tx, err := r.db.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -1,8 +1,18 @@
|
|||||||
package components
|
package components
|
||||||
|
|
||||||
templ dropdownButton(content, name, value string) {
|
import domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
|
||||||
|
// isBitActive returns true when the bit at pos (0 indexed) is true.
|
||||||
|
func isBitActive(bits, pos int) bool {
|
||||||
|
return (bits>>pos)&1 == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
templ dropdownButton(content, name, value string, selected bool) {
|
||||||
<label class="inline-block cursor-pointer select-none">
|
<label class="inline-block cursor-pointer select-none">
|
||||||
<input type="checkbox" name={ name } value={ value } class="sr-only peer" />
|
<input type="checkbox" name={ name } value={ value } class="sr-only peer"
|
||||||
|
if selected {
|
||||||
|
checked
|
||||||
|
} />
|
||||||
<span class="peer-checked:bg-blue-600 peer-checked:text-white peer-checked:border-blue-600
|
<span class="peer-checked:bg-blue-600 peer-checked:text-white peer-checked:border-blue-600
|
||||||
px-2 py-1 border border-gray-300 rounded-lg">
|
px-2 py-1 border border-gray-300 rounded-lg">
|
||||||
{ content }
|
{ content }
|
||||||
@ -10,7 +20,7 @@ templ dropdownButton(content, name, value string) {
|
|||||||
</label>
|
</label>
|
||||||
}
|
}
|
||||||
|
|
||||||
templ FilterDropdown() {
|
templ FilterDropdown(filters domainRecipe.SearchFilters) {
|
||||||
<script>
|
<script>
|
||||||
function toggleDropdown() {
|
function toggleDropdown() {
|
||||||
const menu = document.getElementById("filter-dropdown-menu");
|
const menu = document.getElementById("filter-dropdown-menu");
|
||||||
@ -31,13 +41,13 @@ templ FilterDropdown() {
|
|||||||
Meal
|
Meal
|
||||||
</h3>
|
</h3>
|
||||||
<div class="flex text-xs flex-wrap gap-1 gap-y-3">
|
<div class="flex text-xs flex-wrap gap-1 gap-y-3">
|
||||||
@dropdownButton("Breakfast", "meal", "1")
|
@dropdownButton("Breakfast", "meal", "1", isBitActive(filters.MealType, 0))
|
||||||
@dropdownButton("Lunch", "meal", "2")
|
@dropdownButton("Lunch", "meal", "2", isBitActive(filters.MealType, 1))
|
||||||
@dropdownButton("Dinner", "meal", "4")
|
@dropdownButton("Dinner", "meal", "4", isBitActive(filters.MealType, 2))
|
||||||
@dropdownButton("Desert", "meal", "8")
|
@dropdownButton("Desert", "meal", "8", isBitActive(filters.MealType, 3))
|
||||||
@dropdownButton("Snack", "meal", "16")
|
@dropdownButton("Snack", "meal", "16", isBitActive(filters.MealType, 4))
|
||||||
@dropdownButton("Side", "meal", "32")
|
@dropdownButton("Side", "meal", "32", isBitActive(filters.MealType, 5))
|
||||||
@dropdownButton("Other", "meal", "64")
|
@dropdownButton("Other", "meal", "64", isBitActive(filters.MealType, 6))
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full border-b border-gray-300 py-2">
|
<div class="w-full border-b border-gray-300 py-2">
|
||||||
@ -45,11 +55,11 @@ templ FilterDropdown() {
|
|||||||
Cook Time
|
Cook Time
|
||||||
</h3>
|
</h3>
|
||||||
<div class="flex text-xs flex-wrap gap-1 gap-y-3">
|
<div class="flex text-xs flex-wrap gap-1 gap-y-3">
|
||||||
@dropdownButton("< 15 min", "time" , "1")
|
@dropdownButton("< 15 min", "time" , "1" , isBitActive(filters.Time, 0))
|
||||||
@dropdownButton("15 to 30 min", "time" , "2")
|
@dropdownButton("15 to 30 min", "time", "2" , isBitActive(filters.Time, 1))
|
||||||
@dropdownButton("30 to 60 min", "time" , "4")
|
@dropdownButton("30 to 60 min", "time" , "4" , isBitActive(filters.Time, 2))
|
||||||
@dropdownButton("60 to 120 min", "time" , "8")
|
@dropdownButton("60 to 120 min", "time" , "8" , isBitActive(filters.Time, 3))
|
||||||
@dropdownButton("+120 min", "time", "16")
|
@dropdownButton("+120 min", "time" , "16" , isBitActive(filters.Time, 4))
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full border-b border-gray-300 py-2">
|
<div class="w-full border-b border-gray-300 py-2">
|
||||||
@ -57,11 +67,11 @@ templ FilterDropdown() {
|
|||||||
Difficulty
|
Difficulty
|
||||||
</h3>
|
</h3>
|
||||||
<div class="flex text-xs flex-wrap gap-1 gap-y-3">
|
<div class="flex text-xs flex-wrap gap-1 gap-y-3">
|
||||||
@dropdownButton("Beginner", "difficulty", "1")
|
@dropdownButton("Beginner", "difficulty", "1", isBitActive(filters.Difficulty, 0))
|
||||||
@dropdownButton("Easy", "difficulty", "2")
|
@dropdownButton("Easy", "difficulty", "2", isBitActive(filters.Difficulty, 1))
|
||||||
@dropdownButton("Intermediate", "difficulty", "4")
|
@dropdownButton("Intermediate", "difficulty", "4", isBitActive(filters.Difficulty, 2))
|
||||||
@dropdownButton("Challenging", "difficulty", "8")
|
@dropdownButton("Challenging", "difficulty", "8", isBitActive(filters.Difficulty, 3))
|
||||||
@dropdownButton("Extreme", "difficulty", "16")
|
@dropdownButton("Extreme", "difficulty", "16", isBitActive(filters.Difficulty, 4))
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full border-b border-gray-300 py-2">
|
<div class="w-full border-b border-gray-300 py-2">
|
||||||
@ -69,12 +79,18 @@ templ FilterDropdown() {
|
|||||||
Serving Size
|
Serving Size
|
||||||
</h3>
|
</h3>
|
||||||
<div class="flex text-xs flex-wrap gap-1 gap-y-3">
|
<div class="flex text-xs flex-wrap gap-1 gap-y-3">
|
||||||
@dropdownButton("1 to 2", "serving", "1")
|
@dropdownButton("1 to 2", "serving", "1", isBitActive(filters.ServingSize, 0))
|
||||||
@dropdownButton("2 to 4", "serving", "2")
|
@dropdownButton("2 to 4", "serving", "2", isBitActive(filters.ServingSize, 1))
|
||||||
@dropdownButton("4 to 6", "serving", "4")
|
@dropdownButton("4 to 6", "serving", "4", isBitActive(filters.ServingSize, 2))
|
||||||
@dropdownButton("6 to 8", "serving", "8")
|
@dropdownButton("6 to 8", "serving", "8", isBitActive(filters.ServingSize, 3))
|
||||||
@dropdownButton("8+", "serving", "16")
|
@dropdownButton("8+", "serving", "16", isBitActive(filters.ServingSize, 4))
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="w-full pt-2 flex justify-end items-end">
|
||||||
|
<button type="submit"
|
||||||
|
class="w-full text-sm md:text-base text-white rounded-lg py-1.5 md:py-2 bg-blue-600 hover:bg-blue-700 duration-300">
|
||||||
|
Apply Filters
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,14 @@ package components
|
|||||||
import "github.com/a-h/templ"
|
import "github.com/a-h/templ"
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
func dropdownButton(content, name, value string) templ.Component {
|
import domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
|
||||||
|
// isBitActive returns true when the bit at pos (0 indexed) is true.
|
||||||
|
func isBitActive(bits, pos int) bool {
|
||||||
|
return (bits>>pos)&1 == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func dropdownButton(content, name, value string, selected bool) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -36,7 +43,7 @@ func dropdownButton(content, name, value string) templ.Component {
|
|||||||
var templ_7745c5c3_Var2 string
|
var templ_7745c5c3_Var2 string
|
||||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name)
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/dropdowns.templ`, Line: 5, Col: 36}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/dropdowns.templ`, Line: 12, Col: 36}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -49,26 +56,36 @@ func dropdownButton(content, name, value string) templ.Component {
|
|||||||
var templ_7745c5c3_Var3 string
|
var templ_7745c5c3_Var3 string
|
||||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(value)
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(value)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/dropdowns.templ`, Line: 5, Col: 52}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/dropdowns.templ`, Line: 12, Col: 52}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" class=\"sr-only peer\"> <span class=\"peer-checked:bg-blue-600 peer-checked:text-white peer-checked:border-blue-600\n px-2 py-1 border border-gray-300 rounded-lg\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\" class=\"sr-only peer\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
if selected {
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " checked")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "> <span class=\"peer-checked:bg-blue-600 peer-checked:text-white peer-checked:border-blue-600\n px-2 py-1 border border-gray-300 rounded-lg\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var4 string
|
var templ_7745c5c3_Var4 string
|
||||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(content)
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(content)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/dropdowns.templ`, Line: 8, Col: 13}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/dropdowns.templ`, Line: 18, Col: 13}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</span></label>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</span></label>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -76,7 +93,7 @@ func dropdownButton(content, name, value string) templ.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func FilterDropdown() templ.Component {
|
func FilterDropdown(filters domainRecipe.SearchFilters) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -97,111 +114,111 @@ func FilterDropdown() templ.Component {
|
|||||||
templ_7745c5c3_Var5 = templ.NopComponent
|
templ_7745c5c3_Var5 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<script>\n function toggleDropdown() {\n const menu = document.getElementById(\"filter-dropdown-menu\");\n const button = document.getElementById(\"filter-dropdown-button\");\n\n if (menu.classList.contains(\"block\")) {\n menu.classList.remove(\"block\");\n menu.classList.add(\"hidden\");\n } else {\n menu.classList.remove(\"hidden\");\n menu.classList.add(\"block\");\n }\n }\n</script><div id=\"filter-dropdown-menu\" class=\"hidden w-full p-2 border border-gray-300 my-2 rounded-lg\"><div class=\"w-full border-b border-gray-300 py-2\"><h3 class=\"mb-2\">Meal</h3><div class=\"flex text-xs flex-wrap gap-1 gap-y-3\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<script>\n function toggleDropdown() {\n const menu = document.getElementById(\"filter-dropdown-menu\");\n const button = document.getElementById(\"filter-dropdown-button\");\n\n if (menu.classList.contains(\"block\")) {\n menu.classList.remove(\"block\");\n menu.classList.add(\"hidden\");\n } else {\n menu.classList.remove(\"hidden\");\n menu.classList.add(\"block\");\n }\n }\n</script><div id=\"filter-dropdown-menu\" class=\"hidden w-full p-2 border border-gray-300 my-2 rounded-lg\"><div class=\"w-full border-b border-gray-300 py-2\"><h3 class=\"mb-2\">Meal</h3><div class=\"flex text-xs flex-wrap gap-1 gap-y-3\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Breakfast", "meal", "1").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Breakfast", "meal", "1", isBitActive(filters.MealType, 0)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Lunch", "meal", "2").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Lunch", "meal", "2", isBitActive(filters.MealType, 1)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Dinner", "meal", "4").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Dinner", "meal", "4", isBitActive(filters.MealType, 2)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Desert", "meal", "8").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Desert", "meal", "8", isBitActive(filters.MealType, 3)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Snack", "meal", "16").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Snack", "meal", "16", isBitActive(filters.MealType, 4)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Side", "meal", "32").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Side", "meal", "32", isBitActive(filters.MealType, 5)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Other", "meal", "64").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Other", "meal", "64", isBitActive(filters.MealType, 6)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</div></div><div class=\"w-full border-b border-gray-300 py-2\"><h3 class=\"mb-2\">Cook Time</h3><div class=\"flex text-xs flex-wrap gap-1 gap-y-3\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</div></div><div class=\"w-full border-b border-gray-300 py-2\"><h3 class=\"mb-2\">Cook Time</h3><div class=\"flex text-xs flex-wrap gap-1 gap-y-3\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("< 15 min", "time", "1").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("< 15 min", "time", "1", isBitActive(filters.Time, 0)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("15 to 30 min", "time", "2").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("15 to 30 min", "time", "2", isBitActive(filters.Time, 1)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("30 to 60 min", "time", "4").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("30 to 60 min", "time", "4", isBitActive(filters.Time, 2)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("60 to 120 min", "time", "8").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("60 to 120 min", "time", "8", isBitActive(filters.Time, 3)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("+120 min", "time", "16").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("+120 min", "time", "16", isBitActive(filters.Time, 4)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</div></div><div class=\"w-full border-b border-gray-300 py-2\"><h3 class=\"mb-2\">Difficulty</h3><div class=\"flex text-xs flex-wrap gap-1 gap-y-3\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</div></div><div class=\"w-full border-b border-gray-300 py-2\"><h3 class=\"mb-2\">Difficulty</h3><div class=\"flex text-xs flex-wrap gap-1 gap-y-3\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Beginner", "difficulty", "1").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Beginner", "difficulty", "1", isBitActive(filters.Difficulty, 0)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Easy", "difficulty", "2").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Easy", "difficulty", "2", isBitActive(filters.Difficulty, 1)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Intermediate", "difficulty", "4").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Intermediate", "difficulty", "4", isBitActive(filters.Difficulty, 2)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Challenging", "difficulty", "8").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Challenging", "difficulty", "8", isBitActive(filters.Difficulty, 3)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("Extreme", "difficulty", "16").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("Extreme", "difficulty", "16", isBitActive(filters.Difficulty, 4)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</div></div><div class=\"w-full border-b border-gray-300 py-2\"><h3 class=\"mb-2\">Serving Size</h3><div class=\"flex text-xs flex-wrap gap-1 gap-y-3\">")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</div></div><div class=\"w-full border-b border-gray-300 py-2\"><h3 class=\"mb-2\">Serving Size</h3><div class=\"flex text-xs flex-wrap gap-1 gap-y-3\">")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("1 to 2", "serving", "1").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("1 to 2", "serving", "1", isBitActive(filters.ServingSize, 0)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("2 to 4", "serving", "2").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("2 to 4", "serving", "2", isBitActive(filters.ServingSize, 1)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("4 to 6", "serving", "4").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("4 to 6", "serving", "4", isBitActive(filters.ServingSize, 2)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("6 to 8", "serving", "8").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("6 to 8", "serving", "8", isBitActive(filters.ServingSize, 3)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = dropdownButton("8+", "serving", "16").Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = dropdownButton("8+", "serving", "16", isBitActive(filters.ServingSize, 4)).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</div></div></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</div></div><div class=\"w-full pt-2 flex justify-end items-end\"><button type=\"submit\" class=\"w-full text-sm md:text-base text-white rounded-lg py-1.5 md:py-2 bg-blue-600 hover:bg-blue-700 duration-300\">Apply Filters</button></div></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,25 @@
|
|||||||
package components
|
package components
|
||||||
|
|
||||||
import "github.com/haydenhargreaves/Potion/internal/domain/server"
|
import domainServer "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
|
import domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
|
||||||
templ SearchBar() {
|
templ SearchBar(filters domainRecipe.SearchFilters, redirect bool) {
|
||||||
<form
|
<form
|
||||||
hx-post={ domain.API_SEARCH_RECIPES }
|
hx-post={ domainServer.API_SEARCH_RECIPES }
|
||||||
hx-swap="innerHTML"
|
hx-swap="innerHTML"
|
||||||
hx-target="#result-list"
|
hx-target="#result-list"
|
||||||
hx-trigger="submit"
|
hx-trigger="submit"
|
||||||
hx-encoding="multipart/form-data"
|
hx-encoding="multipart/form-data"
|
||||||
class="w-full px-4 my-8"
|
class="w-full px-4 my-8"
|
||||||
>
|
>
|
||||||
<p id="result"></p>
|
|
||||||
<div class="flex w-full gap-x-2">
|
<div class="flex w-full gap-x-2">
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
|
<input type="hidden" name="redirect" value={redirect} />
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
name="search"
|
name="search"
|
||||||
placeholder="Search recipes, ingredients..."
|
placeholder="Search recipes, ingredients..."
|
||||||
|
value={ filters.Search }
|
||||||
class="w-full pr-4 pl-10 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
class="w-full pr-4 pl-10 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||||
/>
|
/>
|
||||||
<button type="submit" class="absolute left-3 top-1/2 -translate-y-1/2">
|
<button type="submit" class="absolute left-3 top-1/2 -translate-y-1/2">
|
||||||
@ -39,7 +41,7 @@ templ SearchBar() {
|
|||||||
</div>
|
</div>
|
||||||
@filterButton()
|
@filterButton()
|
||||||
</div>
|
</div>
|
||||||
@FilterDropdown()
|
@FilterDropdown(filters)
|
||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,9 +8,10 @@ package components
|
|||||||
import "github.com/a-h/templ"
|
import "github.com/a-h/templ"
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
import "github.com/haydenhargreaves/Potion/internal/domain/server"
|
import domainServer "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
|
import domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
|
||||||
func SearchBar() templ.Component {
|
func SearchBar(filters domainRecipe.SearchFilters, redirect bool) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -36,15 +37,41 @@ func SearchBar() templ.Component {
|
|||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
var templ_7745c5c3_Var2 string
|
var templ_7745c5c3_Var2 string
|
||||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(domain.API_SEARCH_RECIPES)
|
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(domainServer.API_SEARCH_RECIPES)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/search_bar.templ`, Line: 7, Col: 37}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/search_bar.templ`, Line: 8, Col: 43}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" hx-swap=\"innerHTML\" hx-target=\"#result-list\" hx-trigger=\"submit\" hx-encoding=\"multipart/form-data\" class=\"w-full px-4 my-8\"><p id=\"result\"></p><div class=\"flex w-full gap-x-2\"><div class=\"relative w-full\"><input type=\"search\" name=\"search\" placeholder=\"Search recipes, ingredients...\" class=\"w-full pr-4 pl-10 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500\"> <button type=\"submit\" class=\"absolute left-3 top-1/2 -translate-y-1/2\"><svg class=\"h-5 w-5 text-gray-400\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z\"></path></svg></button></div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" hx-swap=\"innerHTML\" hx-target=\"#result-list\" hx-trigger=\"submit\" hx-encoding=\"multipart/form-data\" class=\"w-full px-4 my-8\"><div class=\"flex w-full gap-x-2\"><div class=\"relative w-full\"><input type=\"hidden\" name=\"redirect\" value=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var3 string
|
||||||
|
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(redirect)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/search_bar.templ`, Line: 17, Col: 60}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\"> <input type=\"search\" name=\"search\" placeholder=\"Search recipes, ingredients...\" value=\"")
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
var templ_7745c5c3_Var4 string
|
||||||
|
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(filters.Search)
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/components/search_bar.templ`, Line: 22, Col: 27}
|
||||||
|
}
|
||||||
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||||
|
if templ_7745c5c3_Err != nil {
|
||||||
|
return templ_7745c5c3_Err
|
||||||
|
}
|
||||||
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\" class=\"w-full pr-4 pl-10 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500\"> <button type=\"submit\" class=\"absolute left-3 top-1/2 -translate-y-1/2\"><svg class=\"h-5 w-5 text-gray-400\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z\"></path></svg></button></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -52,15 +79,15 @@ func SearchBar() templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</div>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = FilterDropdown().Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = FilterDropdown(filters).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</form>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</form>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -84,12 +111,12 @@ func filterButton() templ.Component {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
|
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
|
||||||
if templ_7745c5c3_Var3 == nil {
|
if templ_7745c5c3_Var5 == nil {
|
||||||
templ_7745c5c3_Var3 = templ.NopComponent
|
templ_7745c5c3_Var5 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<button type=\"button\" id=\"filter-dropdown-button\" onclick=\"toggleDropdown()\" class=\"text-gray-400 border border-gray-300 rounded-lg p-2 focus:outline-none focus:ring-2 focus:ring-blue-500\"><svg class=\"h-6\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M6 11.1707L6 4C6 3.44771 5.55228 3 5 3C4.44771 3 4 3.44771 4 4L4 11.1707C2.83481 11.5825 2 12.6938 2 14C2 15.3062 2.83481 16.4175 4 16.8293L4 20C4 20.5523 4.44772 21 5 21C5.55228 21 6 20.5523 6 20L6 16.8293C7.16519 16.4175 8 15.3062 8 14C8 12.6938 7.16519 11.5825 6 11.1707ZM5 13C4.44772 13 4 13.4477 4 14C4 14.5523 4.44772 15 5 15C5.55228 15 6 14.5523 6 14C6 13.4477 5.55228 13 5 13Z\" fill=\"currentColor\"></path> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M19 21C18.4477 21 18 20.5523 18 20L18 18C18 17.9435 18.0047 17.8881 18.0137 17.8341C16.8414 17.4262 16 16.3113 16 15C16 13.6887 16.8414 12.5738 18.0137 12.1659C18.0047 12.1119 18 12.0565 18 12L18 4C18 3.44771 18.4477 3 19 3C19.5523 3 20 3.44771 20 4L20 12C20 12.0565 19.9953 12.1119 19.9863 12.1659C21.1586 12.5738 22 13.6887 22 15C22 16.3113 21.1586 17.4262 19.9863 17.8341C19.9953 17.8881 20 17.9435 20 18V20C20 20.5523 19.5523 21 19 21ZM18 15C18 14.4477 18.4477 14 19 14C19.5523 14 20 14.4477 20 15C20 15.5523 19.5523 16 19 16C18.4477 16 18 15.5523 18 15Z\" fill=\"currentColor\"></path> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 9C9 7.69378 9.83481 6.58254 11 6.17071V4C11 3.44772 11.4477 3 12 3C12.5523 3 13 3.44772 13 4V6.17071C14.1652 6.58254 15 7.69378 15 9C15 10.3113 14.1586 11.4262 12.9863 11.8341C12.9953 11.8881 13 11.9435 13 12L13 20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20L11 12C11 11.9435 11.0047 11.8881 11.0137 11.8341C9.84135 11.4262 9 10.3113 9 9ZM11 9C11 8.44772 11.4477 8 12 8C12.5523 8 13 8.44772 13 9C13 9.55229 12.5523 10 12 10C11.4477 10 11 9.55229 11 9Z\" fill=\"currentColor\"></path></svg></button>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<button type=\"button\" id=\"filter-dropdown-button\" onclick=\"toggleDropdown()\" class=\"text-gray-400 border border-gray-300 rounded-lg p-2 focus:outline-none focus:ring-2 focus:ring-blue-500\"><svg class=\"h-6\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M6 11.1707L6 4C6 3.44771 5.55228 3 5 3C4.44771 3 4 3.44771 4 4L4 11.1707C2.83481 11.5825 2 12.6938 2 14C2 15.3062 2.83481 16.4175 4 16.8293L4 20C4 20.5523 4.44772 21 5 21C5.55228 21 6 20.5523 6 20L6 16.8293C7.16519 16.4175 8 15.3062 8 14C8 12.6938 7.16519 11.5825 6 11.1707ZM5 13C4.44772 13 4 13.4477 4 14C4 14.5523 4.44772 15 5 15C5.55228 15 6 14.5523 6 14C6 13.4477 5.55228 13 5 13Z\" fill=\"currentColor\"></path> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M19 21C18.4477 21 18 20.5523 18 20L18 18C18 17.9435 18.0047 17.8881 18.0137 17.8341C16.8414 17.4262 16 16.3113 16 15C16 13.6887 16.8414 12.5738 18.0137 12.1659C18.0047 12.1119 18 12.0565 18 12L18 4C18 3.44771 18.4477 3 19 3C19.5523 3 20 3.44771 20 4L20 12C20 12.0565 19.9953 12.1119 19.9863 12.1659C21.1586 12.5738 22 13.6887 22 15C22 16.3113 21.1586 17.4262 19.9863 17.8341C19.9953 17.8881 20 17.9435 20 18V20C20 20.5523 19.5523 21 19 21ZM18 15C18 14.4477 18.4477 14 19 14C19.5523 14 20 14.4477 20 15C20 15.5523 19.5523 16 19 16C18.4477 16 18 15.5523 18 15Z\" fill=\"currentColor\"></path> <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M9 9C9 7.69378 9.83481 6.58254 11 6.17071V4C11 3.44772 11.4477 3 12 3C12.5523 3 13 3.44772 13 4V6.17071C14.1652 6.58254 15 7.69378 15 9C15 10.3113 14.1586 11.4262 12.9863 11.8341C12.9953 11.8881 13 11.9435 13 12L13 20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20L11 12C11 11.9435 11.0047 11.8881 11.0137 11.8341C9.84135 11.4262 9 10.3113 9 9ZM11 9C11 8.44772 11.4477 8 12 8C12.5523 8 13 8.44772 13 9C13 9.55229 12.5523 10 12 10C11.4477 10 11 9.55229 11 9Z\" fill=\"currentColor\"></path></svg></button>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ templ Page() {
|
|||||||
<input
|
<input
|
||||||
onkeydown="return event.key != 'Enter';"
|
onkeydown="return event.key != 'Enter';"
|
||||||
class="border border-gray-300 px-4 py-2 rounded-lg focus:outline-none focus:ring-blue-500 focus:ring-2 duration-200 ease-in-out transition-all shadow-sm"
|
class="border border-gray-300 px-4 py-2 rounded-lg focus:outline-none focus:ring-blue-500 focus:ring-2 duration-200 ease-in-out transition-all shadow-sm"
|
||||||
hx-post="/v1/web/state/tags"
|
hx-post={domain.STATE_TAGS_CREATE}
|
||||||
maxlength="32"
|
maxlength="32"
|
||||||
hx-trigger="keyup[keyCode==13]"
|
hx-trigger="keyup[keyCode==13]"
|
||||||
hx-on::after-request="this.value=''"
|
hx-on::after-request="this.value=''"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -2,6 +2,7 @@ package templates
|
|||||||
|
|
||||||
import "github.com/haydenhargreaves/Potion/internal/templates/components"
|
import "github.com/haydenhargreaves/Potion/internal/templates/components"
|
||||||
import "github.com/haydenhargreaves/Potion/internal/domain/server"
|
import "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
|
import domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
|
||||||
templ introSection() {
|
templ introSection() {
|
||||||
<section class="w-full h-fit mb-16">
|
<section class="w-full h-fit mb-16">
|
||||||
@ -28,7 +29,8 @@ templ introSection() {
|
|||||||
templ searchSection() {
|
templ searchSection() {
|
||||||
<section class="w-full flex flex-col items-center justify-center my-8 py-4">
|
<section class="w-full flex flex-col items-center justify-center my-8 py-4">
|
||||||
@components.BannerText("Craving Something Specific?")
|
@components.BannerText("Craving Something Specific?")
|
||||||
@components.SearchBar()
|
@components.SearchBar(domainRecipe.SearchFilters{}, true)
|
||||||
|
<div class="hidden" id="result-list"></div>
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
|
|||||||
|
|
||||||
import "github.com/haydenhargreaves/Potion/internal/templates/components"
|
import "github.com/haydenhargreaves/Potion/internal/templates/components"
|
||||||
import "github.com/haydenhargreaves/Potion/internal/domain/server"
|
import "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
|
import domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
|
||||||
func introSection() templ.Component {
|
func introSection() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
@ -69,11 +70,11 @@ func searchSection() templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = components.SearchBar().Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = components.SearchBar(domainRecipe.SearchFilters{}, true).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</section>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<div class=\"hidden\" id=\"result-list\"></div></section>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,13 @@ package templates
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/haydenhargreaves/Potion/internal/templates/components"
|
|
||||||
"github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
"github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
domainServer "github.com/haydenhargreaves/Potion/internal/domain/server"
|
domainServer "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
|
"github.com/haydenhargreaves/Potion/internal/templates/components"
|
||||||
)
|
)
|
||||||
|
|
||||||
templ SearchPage() {
|
templ SearchPage(filters domainRecipe.SearchFilters) {
|
||||||
@components.Navbar("")
|
@components.Navbar("")
|
||||||
<div class="w-full flex justify-center">
|
<div class="w-full flex justify-center">
|
||||||
<div
|
<div
|
||||||
@ -15,7 +16,7 @@ templ SearchPage() {
|
|||||||
bg-white flex flex-col items-center"
|
bg-white flex flex-col items-center"
|
||||||
>
|
>
|
||||||
@components.BannerText("Recipe Search")
|
@components.BannerText("Recipe Search")
|
||||||
@components.SearchBar()
|
@components.SearchBar(filters, false)
|
||||||
<hr class="text-gray-300 w-full"/>
|
<hr class="text-gray-300 w-full"/>
|
||||||
@ResultList(nil)
|
@ResultList(nil)
|
||||||
</div>
|
</div>
|
||||||
@ -25,7 +26,7 @@ templ SearchPage() {
|
|||||||
templ ResultList(recipes []domain.Recipe) {
|
templ ResultList(recipes []domain.Recipe) {
|
||||||
<div id="result-list" class="flex flex-col w-full p-4 items-center">
|
<div id="result-list" class="flex flex-col w-full p-4 items-center">
|
||||||
for i, recipe := range recipes {
|
for i, recipe := range recipes {
|
||||||
@searchResult(recipe, i % 2 == 1)
|
@searchResult(recipe, i%2 == 1)
|
||||||
}
|
}
|
||||||
if len(recipes) == 0 || recipes == nil {
|
if len(recipes) == 0 || recipes == nil {
|
||||||
<p class="text-gray-700 text-sm py-4">No results</p>
|
<p class="text-gray-700 text-sm py-4">No results</p>
|
||||||
@ -37,7 +38,7 @@ templ ResultList(recipes []domain.Recipe) {
|
|||||||
|
|
||||||
templ searchResult(recipe domain.Recipe, odd bool) {
|
templ searchResult(recipe domain.Recipe, odd bool) {
|
||||||
<a
|
<a
|
||||||
href={templ.SafeURL(fmt.Sprintf(domainServer.WEB_RECIPE, recipe.Id))}
|
href={ templ.SafeURL(fmt.Sprintf(domainServer.WEB_RECIPE, recipe.Id)) }
|
||||||
if odd {
|
if odd {
|
||||||
class="w-full p-2 border-b border-gray-200 hover:bg-gray-100 duration-200 flex items-center flex-col md:flex-row bg-[#f8f8f8]"
|
class="w-full p-2 border-b border-gray-200 hover:bg-gray-100 duration-200 flex items-center flex-col md:flex-row bg-[#f8f8f8]"
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -11,11 +11,12 @@ import templruntime "github.com/a-h/templ/runtime"
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
"github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
|
domainRecipe "github.com/haydenhargreaves/Potion/internal/domain/recipe"
|
||||||
domainServer "github.com/haydenhargreaves/Potion/internal/domain/server"
|
domainServer "github.com/haydenhargreaves/Potion/internal/domain/server"
|
||||||
"github.com/haydenhargreaves/Potion/internal/templates/components"
|
"github.com/haydenhargreaves/Potion/internal/templates/components"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SearchPage() templ.Component {
|
func SearchPage(filters domainRecipe.SearchFilters) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||||
@ -48,7 +49,7 @@ func SearchPage() templ.Component {
|
|||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = components.SearchBar().Render(ctx, templ_7745c5c3_Buffer)
|
templ_7745c5c3_Err = components.SearchBar(filters, false).Render(ctx, templ_7745c5c3_Buffer)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
@ -170,7 +171,7 @@ func searchResult(recipe domain.Recipe, odd bool) templ.Component {
|
|||||||
var templ_7745c5c3_Var5 string
|
var templ_7745c5c3_Var5 string
|
||||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Title)
|
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Title)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 50, Col: 20}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 51, Col: 18}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -183,7 +184,7 @@ func searchResult(recipe domain.Recipe, odd bool) templ.Component {
|
|||||||
var templ_7745c5c3_Var6 string
|
var templ_7745c5c3_Var6 string
|
||||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Category)
|
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Category)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 50, Col: 74}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 51, Col: 72}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -200,7 +201,7 @@ func searchResult(recipe domain.Recipe, odd bool) templ.Component {
|
|||||||
var templ_7745c5c3_Var7 string
|
var templ_7745c5c3_Var7 string
|
||||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Duration.Total)
|
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Duration.Total)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 55, Col: 33}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 56, Col: 28}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -237,7 +238,7 @@ func searchResult(recipe domain.Recipe, odd bool) templ.Component {
|
|||||||
var templ_7745c5c3_Var8 string
|
var templ_7745c5c3_Var8 string
|
||||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Serves)
|
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Serves)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 67, Col: 27}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 68, Col: 27}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
@ -250,7 +251,7 @@ func searchResult(recipe domain.Recipe, odd bool) templ.Component {
|
|||||||
var templ_7745c5c3_Var9 string
|
var templ_7745c5c3_Var9 string
|
||||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Description)
|
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(recipe.Description)
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 70, Col: 72}
|
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/templates/pages/search.templ`, Line: 71, Col: 72}
|
||||||
}
|
}
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
'Noto Color Emoji';
|
'Noto Color Emoji';
|
||||||
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
||||||
monospace;
|
monospace;
|
||||||
--color-red-50: oklch(97.1% 0.013 17.38);
|
|
||||||
--color-red-100: oklch(93.6% 0.032 17.717);
|
--color-red-100: oklch(93.6% 0.032 17.717);
|
||||||
--color-red-500: oklch(63.7% 0.237 25.331);
|
--color-red-500: oklch(63.7% 0.237 25.331);
|
||||||
--color-green-100: oklch(96.2% 0.044 156.743);
|
--color-green-100: oklch(96.2% 0.044 156.743);
|
||||||
@ -34,7 +33,6 @@
|
|||||||
--color-black: #000;
|
--color-black: #000;
|
||||||
--color-white: #fff;
|
--color-white: #fff;
|
||||||
--spacing: 0.25rem;
|
--spacing: 0.25rem;
|
||||||
--container-xl: 36rem;
|
|
||||||
--container-2xl: 42rem;
|
--container-2xl: 42rem;
|
||||||
--text-xs: 0.75rem;
|
--text-xs: 0.75rem;
|
||||||
--text-xs--line-height: calc(1 / 0.75);
|
--text-xs--line-height: calc(1 / 0.75);
|
||||||
@ -236,9 +234,6 @@
|
|||||||
.static {
|
.static {
|
||||||
position: static;
|
position: static;
|
||||||
}
|
}
|
||||||
.top-1 {
|
|
||||||
top: calc(var(--spacing) * 1);
|
|
||||||
}
|
|
||||||
.top-1\/2 {
|
.top-1\/2 {
|
||||||
top: calc(1/2 * 100%);
|
top: calc(1/2 * 100%);
|
||||||
}
|
}
|
||||||
@ -248,9 +243,6 @@
|
|||||||
.left-0 {
|
.left-0 {
|
||||||
left: calc(var(--spacing) * 0);
|
left: calc(var(--spacing) * 0);
|
||||||
}
|
}
|
||||||
.left-1 {
|
|
||||||
left: calc(var(--spacing) * 1);
|
|
||||||
}
|
|
||||||
.left-1\/2 {
|
.left-1\/2 {
|
||||||
left: calc(1/2 * 100%);
|
left: calc(1/2 * 100%);
|
||||||
}
|
}
|
||||||
@ -272,6 +264,9 @@
|
|||||||
.mx-auto {
|
.mx-auto {
|
||||||
margin-inline: auto;
|
margin-inline: auto;
|
||||||
}
|
}
|
||||||
|
.my-0 {
|
||||||
|
margin-block: calc(var(--spacing) * 0);
|
||||||
|
}
|
||||||
.my-1 {
|
.my-1 {
|
||||||
margin-block: calc(var(--spacing) * 1);
|
margin-block: calc(var(--spacing) * 1);
|
||||||
}
|
}
|
||||||
@ -361,18 +356,10 @@
|
|||||||
width: calc(var(--spacing) * 10);
|
width: calc(var(--spacing) * 10);
|
||||||
height: calc(var(--spacing) * 10);
|
height: calc(var(--spacing) * 10);
|
||||||
}
|
}
|
||||||
.size-28 {
|
|
||||||
width: calc(var(--spacing) * 28);
|
|
||||||
height: calc(var(--spacing) * 28);
|
|
||||||
}
|
|
||||||
.size-32 {
|
.size-32 {
|
||||||
width: calc(var(--spacing) * 32);
|
width: calc(var(--spacing) * 32);
|
||||||
height: calc(var(--spacing) * 32);
|
height: calc(var(--spacing) * 32);
|
||||||
}
|
}
|
||||||
.size-40 {
|
|
||||||
width: calc(var(--spacing) * 40);
|
|
||||||
height: calc(var(--spacing) * 40);
|
|
||||||
}
|
|
||||||
.size-56 {
|
.size-56 {
|
||||||
width: calc(var(--spacing) * 56);
|
width: calc(var(--spacing) * 56);
|
||||||
height: calc(var(--spacing) * 56);
|
height: calc(var(--spacing) * 56);
|
||||||
@ -414,18 +401,12 @@
|
|||||||
.min-h-screen {
|
.min-h-screen {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
.w-1 {
|
|
||||||
width: calc(var(--spacing) * 1);
|
|
||||||
}
|
|
||||||
.w-1\/3 {
|
.w-1\/3 {
|
||||||
width: calc(1/3 * 100%);
|
width: calc(1/3 * 100%);
|
||||||
}
|
}
|
||||||
.w-1\/4 {
|
.w-1\/4 {
|
||||||
width: calc(1/4 * 100%);
|
width: calc(1/4 * 100%);
|
||||||
}
|
}
|
||||||
.w-3 {
|
|
||||||
width: calc(var(--spacing) * 3);
|
|
||||||
}
|
|
||||||
.w-3\/4 {
|
.w-3\/4 {
|
||||||
width: calc(3/4 * 100%);
|
width: calc(3/4 * 100%);
|
||||||
}
|
}
|
||||||
@ -438,9 +419,6 @@
|
|||||||
.w-5 {
|
.w-5 {
|
||||||
width: calc(var(--spacing) * 5);
|
width: calc(var(--spacing) * 5);
|
||||||
}
|
}
|
||||||
.w-9 {
|
|
||||||
width: calc(var(--spacing) * 9);
|
|
||||||
}
|
|
||||||
.w-9\/10 {
|
.w-9\/10 {
|
||||||
width: calc(9/10 * 100%);
|
width: calc(9/10 * 100%);
|
||||||
}
|
}
|
||||||
@ -459,30 +437,16 @@
|
|||||||
.max-w-2xl {
|
.max-w-2xl {
|
||||||
max-width: var(--container-2xl);
|
max-width: var(--container-2xl);
|
||||||
}
|
}
|
||||||
.flex-shrink {
|
|
||||||
flex-shrink: 1;
|
|
||||||
}
|
|
||||||
.flex-shrink-0 {
|
.flex-shrink-0 {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.flex-grow {
|
.flex-grow {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
.border-collapse {
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
.-translate-x-1 {
|
|
||||||
--tw-translate-x: calc(var(--spacing) * -1);
|
|
||||||
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
||||||
}
|
|
||||||
.-translate-x-1\/2 {
|
.-translate-x-1\/2 {
|
||||||
--tw-translate-x: calc(calc(1/2 * 100%) * -1);
|
--tw-translate-x: calc(calc(1/2 * 100%) * -1);
|
||||||
translate: var(--tw-translate-x) var(--tw-translate-y);
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
||||||
}
|
}
|
||||||
.-translate-y-1 {
|
|
||||||
--tw-translate-y: calc(var(--spacing) * -1);
|
|
||||||
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
||||||
}
|
|
||||||
.-translate-y-1\/2 {
|
.-translate-y-1\/2 {
|
||||||
--tw-translate-y: calc(calc(1/2 * 100%) * -1);
|
--tw-translate-y: calc(calc(1/2 * 100%) * -1);
|
||||||
translate: var(--tw-translate-x) var(--tw-translate-y);
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
||||||
@ -490,9 +454,6 @@
|
|||||||
.cursor-pointer {
|
.cursor-pointer {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.resize {
|
|
||||||
resize: both;
|
|
||||||
}
|
|
||||||
.resize-none {
|
.resize-none {
|
||||||
resize: none;
|
resize: none;
|
||||||
}
|
}
|
||||||
@ -523,6 +484,9 @@
|
|||||||
.justify-center {
|
.justify-center {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
.justify-end {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
.justify-start {
|
.justify-start {
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
@ -550,15 +514,9 @@
|
|||||||
.gap-y-1 {
|
.gap-y-1 {
|
||||||
row-gap: calc(var(--spacing) * 1);
|
row-gap: calc(var(--spacing) * 1);
|
||||||
}
|
}
|
||||||
.gap-y-2 {
|
|
||||||
row-gap: calc(var(--spacing) * 2);
|
|
||||||
}
|
|
||||||
.gap-y-3 {
|
.gap-y-3 {
|
||||||
row-gap: calc(var(--spacing) * 3);
|
row-gap: calc(var(--spacing) * 3);
|
||||||
}
|
}
|
||||||
.gap-y-4 {
|
|
||||||
row-gap: calc(var(--spacing) * 4);
|
|
||||||
}
|
|
||||||
.overflow-hidden {
|
.overflow-hidden {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@ -646,6 +604,9 @@
|
|||||||
.bg-blue-500 {
|
.bg-blue-500 {
|
||||||
background-color: var(--color-blue-500);
|
background-color: var(--color-blue-500);
|
||||||
}
|
}
|
||||||
|
.bg-blue-600 {
|
||||||
|
background-color: var(--color-blue-600);
|
||||||
|
}
|
||||||
.bg-gray-50 {
|
.bg-gray-50 {
|
||||||
background-color: var(--color-gray-50);
|
background-color: var(--color-gray-50);
|
||||||
}
|
}
|
||||||
@ -655,9 +616,6 @@
|
|||||||
.bg-gray-200 {
|
.bg-gray-200 {
|
||||||
background-color: var(--color-gray-200);
|
background-color: var(--color-gray-200);
|
||||||
}
|
}
|
||||||
.bg-green-100 {
|
|
||||||
background-color: var(--color-green-100);
|
|
||||||
}
|
|
||||||
.bg-red-100 {
|
.bg-red-100 {
|
||||||
background-color: var(--color-red-100);
|
background-color: var(--color-red-100);
|
||||||
}
|
}
|
||||||
@ -747,6 +705,9 @@
|
|||||||
.py-8 {
|
.py-8 {
|
||||||
padding-block: calc(var(--spacing) * 8);
|
padding-block: calc(var(--spacing) * 8);
|
||||||
}
|
}
|
||||||
|
.pt-2 {
|
||||||
|
padding-top: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
.pr-4 {
|
.pr-4 {
|
||||||
padding-right: calc(var(--spacing) * 4);
|
padding-right: calc(var(--spacing) * 4);
|
||||||
}
|
}
|
||||||
@ -851,9 +812,6 @@
|
|||||||
.text-gray-800 {
|
.text-gray-800 {
|
||||||
color: var(--color-gray-800);
|
color: var(--color-gray-800);
|
||||||
}
|
}
|
||||||
.text-green-600 {
|
|
||||||
color: var(--color-green-600);
|
|
||||||
}
|
|
||||||
.text-red-500 {
|
.text-red-500 {
|
||||||
color: var(--color-red-500);
|
color: var(--color-red-500);
|
||||||
}
|
}
|
||||||
@ -863,9 +821,6 @@
|
|||||||
.uppercase {
|
.uppercase {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
.underline {
|
|
||||||
text-decoration-line: underline;
|
|
||||||
}
|
|
||||||
.shadow {
|
.shadow {
|
||||||
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
||||||
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
||||||
@ -1042,6 +997,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.hover\:bg-blue-700 {
|
||||||
|
&:hover {
|
||||||
|
@media (hover: hover) {
|
||||||
|
background-color: var(--color-blue-700);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.hover\:bg-gray-50 {
|
.hover\:bg-gray-50 {
|
||||||
&:hover {
|
&:hover {
|
||||||
@media (hover: hover) {
|
@media (hover: hover) {
|
||||||
@ -1170,6 +1132,11 @@
|
|||||||
margin-block: calc(var(--spacing) * 0);
|
margin-block: calc(var(--spacing) * 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.md\:my-2 {
|
||||||
|
@media (width >= 48rem) {
|
||||||
|
margin-block: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
.md\:flex {
|
.md\:flex {
|
||||||
@media (width >= 48rem) {
|
@media (width >= 48rem) {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -1275,11 +1242,21 @@
|
|||||||
padding-block: calc(var(--spacing) * 0);
|
padding-block: calc(var(--spacing) * 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.md\:py-2 {
|
||||||
|
@media (width >= 48rem) {
|
||||||
|
padding-block: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
.md\:py-12 {
|
.md\:py-12 {
|
||||||
@media (width >= 48rem) {
|
@media (width >= 48rem) {
|
||||||
padding-block: calc(var(--spacing) * 12);
|
padding-block: calc(var(--spacing) * 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.md\:pt-2 {
|
||||||
|
@media (width >= 48rem) {
|
||||||
|
padding-top: calc(var(--spacing) * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
.md\:pt-14 {
|
.md\:pt-14 {
|
||||||
@media (width >= 48rem) {
|
@media (width >= 48rem) {
|
||||||
padding-top: calc(var(--spacing) * 14);
|
padding-top: calc(var(--spacing) * 14);
|
||||||
@ -1308,6 +1285,12 @@
|
|||||||
line-height: var(--tw-leading, var(--text-4xl--line-height));
|
line-height: var(--tw-leading, var(--text-4xl--line-height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.md\:text-base {
|
||||||
|
@media (width >= 48rem) {
|
||||||
|
font-size: var(--text-base);
|
||||||
|
line-height: var(--tw-leading, var(--text-base--line-height));
|
||||||
|
}
|
||||||
|
}
|
||||||
.md\:text-lg {
|
.md\:text-lg {
|
||||||
@media (width >= 48rem) {
|
@media (width >= 48rem) {
|
||||||
font-size: var(--text-lg);
|
font-size: var(--text-lg);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user