add login page design

This commit is contained in:
Ruidy 2024-05-10 13:00:21 +02:00
parent fee3f660ed
commit aa5ac4dace
No known key found for this signature in database
GPG key ID: E00F51288CB857CC
4 changed files with 92 additions and 2 deletions

View file

@ -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())
}
}

View file

@ -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.

34
internal/view/login.templ Normal file
View file

@ -0,0 +1,34 @@
package view
import (
"github.com/rjNemo/rentease/internal/view/layout"
)
templ Login() {
@layout.BaseLayout() {
<main class="container">
<section>
<h1>Login</h1>
<form>
<input
type="email"
name="email"
placeholder="john@email.com"
aria-label="email"
autocomplete="email"
required
/>
<input
type="password"
name="password"
placeholder="p4Ssw0rD"
aria-label="password"
autocomplete="password"
required
/>
<button type="submit">Log in</button>
</form>
</section>
</main>
}
}

View file

@ -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("<main class=\"container\"><section><h1>Login</h1><form><input type=\"email\" name=\"email\" placeholder=\"john@email.com\" aria-label=\"email\" autocomplete=\"email\" required> <input type=\"password\" name=\"password\" placeholder=\"p4Ssw0rD\" aria-label=\"password\" autocomplete=\"password\" required> <button type=\"submit\">Log in</button></form></section></main>")
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
})
}