Add EnabledPing component for displaying ping status

This commit is contained in:
Luis Eduardo Jeréz Girón
2024-07-24 02:08:41 -06:00
parent 8c9d071395
commit 1554a7acbd

View File

@@ -0,0 +1,28 @@
package component
import (
"github.com/maragudk/gomponents"
"github.com/maragudk/gomponents/components"
"github.com/maragudk/gomponents/html"
)
func EnabledPing(enabled bool) gomponents.Node {
return html.Span(
html.Class("relative flex h-3 w-3"),
html.Span(
components.Classes{
"absolute inline-flex h-full w-full": true,
"animate-ping rounded-full opacity-75": true,
"bg-success": enabled,
"bg-error": !enabled,
},
),
html.Span(
components.Classes{
"relative inline-flex rounded-full h-3 w-3": true,
"bg-success": enabled,
"bg-error": !enabled,
},
),
)
}