From aa5ac4dace9a12a8ebb18b6665f694087e180879 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Fri, 10 May 2024 13:00:21 +0200 Subject: [PATCH] add login page design --- internal/server/handle_auth.go | 4 ++- internal/view/layout/base_templ.go | 2 +- internal/view/login.templ | 34 +++++++++++++++++++ internal/view/login_templ.go | 54 ++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 internal/view/login.templ create mode 100644 internal/view/login_templ.go diff --git a/internal/server/handle_auth.go b/internal/server/handle_auth.go index c5d6669..9350454 100644 --- a/internal/server/handle_auth.go +++ b/internal/server/handle_auth.go @@ -5,11 +5,13 @@ import ( "net/http" "github.com/labstack/echo/v4" + + "github.com/rjNemo/rentease/internal/view" ) func handleLoginPage() echo.HandlerFunc { return func(c echo.Context) error { - return c.String(http.StatusOK, "ok") + return renderTempl(c, http.StatusOK, view.Login()) } } diff --git a/internal/view/layout/base_templ.go b/internal/view/layout/base_templ.go index ba4e300..180f9dd 100644 --- a/internal/view/layout/base_templ.go +++ b/internal/view/layout/base_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.543 +// templ: version: v0.2.663 package layout //lint:file-ignore SA4006 This context is only used if a nested component is present. diff --git a/internal/view/login.templ b/internal/view/login.templ new file mode 100644 index 0000000..d5afc50 --- /dev/null +++ b/internal/view/login.templ @@ -0,0 +1,34 @@ +package view + +import ( + "github.com/rjNemo/rentease/internal/view/layout" +) + +templ Login() { + @layout.BaseLayout() { +
+
+

Login

+
+ + + +
+
+
+ } +} diff --git a/internal/view/login_templ.go b/internal/view/login_templ.go new file mode 100644 index 0000000..0dedf1f --- /dev/null +++ b/internal/view/login_templ.go @@ -0,0 +1,54 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package view + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import "context" +import "io" +import "bytes" + +import ( + "github.com/rjNemo/rentease/internal/view/layout" +) + +func Login() templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var2 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Login

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.BaseLayout().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +}