From 081ce0cf12fd27cdf1d6eafbeaa09e500b146738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Eduardo=20Jer=C3=A9z=20Gir=C3=B3n?= Date: Mon, 22 Jul 2024 23:57:03 -0600 Subject: [PATCH] Add StarOnGithub component and update auth layout --- internal/view/web/component/star_on_github.go | 33 +++++++++++++++++++ internal/view/web/layout/auth.go | 6 +++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 internal/view/web/component/star_on_github.go diff --git a/internal/view/web/component/star_on_github.go b/internal/view/web/component/star_on_github.go new file mode 100644 index 0000000..9974740 --- /dev/null +++ b/internal/view/web/component/star_on_github.go @@ -0,0 +1,33 @@ +package component + +import ( + "github.com/maragudk/gomponents" + "github.com/maragudk/gomponents/html" +) + +func StarOnGithub(size size) gomponents.Node { + small := html.IFrame( + html.Src("https://ghbtns.com/github-btn.html?user=eduardolat&repo=pgbackweb&type=star&count=true"), + gomponents.Attr("frameborder", "0"), + gomponents.Attr("scrolling", "0"), + html.Width("150"), + html.Height("20"), + ) + + big := html.IFrame( + html.Src("https://ghbtns.com/github-btn.html?user=eduardolat&repo=pgbackweb&type=star&count=true&size=large"), + gomponents.Attr("frameborder", "0"), + gomponents.Attr("scrolling", "0"), + html.Width("170"), + html.Height("30"), + ) + + switch size { + case SizeSm: + return small + case SizeMd: + return big + default: + return big + } +} diff --git a/internal/view/web/layout/auth.go b/internal/view/web/layout/auth.go index c2c0a9b..c216208 100644 --- a/internal/view/web/layout/auth.go +++ b/internal/view/web/layout/auth.go @@ -51,7 +51,11 @@ func Auth(params AuthParams) gomponents.Node { html.Class("rounded-box shadow-md bg-base-100 p-4"), gomponents.Group(params.Body), ), - component.ChangeThemeButton(component.DropdownPositionTop, false), + html.Div( + html.Class("flex justify-between items-start"), + component.StarOnGithub(component.SizeMd), + component.ChangeThemeButton(component.DropdownPositionTop, false), + ), ), }, })