Files
AnthoLume/web/components/ui/notification.go
Evan Reichard 43af4d0a01
Some checks failed
continuous-integration/drone/pr Build is failing
chore: migrate admin general
2025-11-12 19:13:16 -05:00

29 lines
673 B
Go

package ui
import (
g "maragu.dev/gomponents"
h "maragu.dev/gomponents/html"
"reichard.io/antholume/pkg/sliceutils"
"reichard.io/antholume/web/models"
)
func Notifications(notifications []*models.Notification) g.Node {
if len(notifications) == 0 {
return nil
}
return h.Div(
h.Class("fixed flex flex-col gap-2 bottom-0 right-0 text-white dark:text-black"),
g.Group(sliceutils.Map(notifications, notificationNode)),
)
}
func notificationNode(n *models.Notification) g.Node {
return h.Div(
h.Class("p-2 sm:p-4 animate-notification"),
h.Div(
h.Class("bg-gray-600 dark:bg-gray-400 px-4 py-2 rounded-lg shadow-lg w-64"),
g.Text(n.Content),
),
)
}