Skip to content

Commit

Permalink
feat: render toast function
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Jun 27, 2024
1 parent f2a0a88 commit 4aa2126
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/toasts/toaster.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package toasts

import (
"github.com/gofiber/fiber/v2"
htmx "github.com/zeiss/fiber-htmx"
)

Expand Down Expand Up @@ -41,6 +42,13 @@ func Toaster(props ToastsProps, children ...htmx.Node) htmx.Node {
)
}

// RenderToasts is the handler for rendering the toasts.
func RenderToasts(c *fiber.Ctx, children ...htmx.Node) htmx.Node {
htmx.ReSwap(c, "none") // this forces htmx not to replace the content

return htmx.Fragment(children...)
}

// Toasts are messsage to toast.
func Toasts(props ToastsProps, children ...htmx.Node) htmx.Node {
if props.ID == "" {
Expand Down

0 comments on commit 4aa2126

Please sign in to comment.