Migrate from templates to Gomponents (#103)
This commit is contained in:
parent
0bf9ab7189
commit
051d032038
104 changed files with 2768 additions and 2824 deletions
46
pkg/ui/pages/auth.go
Normal file
46
pkg/ui/pages/auth.go
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package pages
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/mikestefanello/pagoda/pkg/ui"
|
||||
"github.com/mikestefanello/pagoda/pkg/ui/forms"
|
||||
"github.com/mikestefanello/pagoda/pkg/ui/layouts"
|
||||
. "maragu.dev/gomponents"
|
||||
. "maragu.dev/gomponents/html"
|
||||
)
|
||||
|
||||
func Login(ctx echo.Context, form *forms.Login) error {
|
||||
r := ui.NewRequest(ctx)
|
||||
r.Title = "Login"
|
||||
|
||||
return r.Render(layouts.Auth, form.Render(r))
|
||||
}
|
||||
|
||||
func Register(ctx echo.Context, form *forms.Register) error {
|
||||
r := ui.NewRequest(ctx)
|
||||
r.Title = "Register"
|
||||
|
||||
return r.Render(layouts.Auth, form.Render(r))
|
||||
}
|
||||
|
||||
func ForgotPassword(ctx echo.Context, form *forms.ForgotPassword) error {
|
||||
r := ui.NewRequest(ctx)
|
||||
r.Title = "Forgot password"
|
||||
|
||||
g := Group{
|
||||
Div(
|
||||
Class("content"),
|
||||
P(Text("Enter your email address and we'll email you a link that allows you to reset your password.")),
|
||||
),
|
||||
form.Render(r),
|
||||
}
|
||||
|
||||
return r.Render(layouts.Auth, g)
|
||||
}
|
||||
|
||||
func ResetPassword(ctx echo.Context, form *forms.ResetPassword) error {
|
||||
r := ui.NewRequest(ctx)
|
||||
r.Title = "Reset your password"
|
||||
|
||||
return r.Render(layouts.Auth, form.Render(r))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue