diff --git a/pages/login.go b/pages/login.go index c2cadc9..0f22c57 100644 --- a/pages/login.go +++ b/pages/login.go @@ -14,7 +14,7 @@ func Login(w http.ResponseWriter, r *http.Request) { w.Header().Add("Location", "/") w.WriteHeader(http.StatusSeeOther) } else { - templates.LoginPage().Render(r.Context(), w) + templates.LoginPage(r.URL.Query().Has("basic")).Render(r.Context(), w) } return } @@ -53,7 +53,7 @@ func CreateAccount(w http.ResponseWriter, r *http.Request) { w.Header().Add("Location", "/") w.WriteHeader(http.StatusSeeOther) } else { - templates.CreateAccountBox().Render(r.Context(), w) + templates.CreateAccountBox(false).Render(r.Context(), w) } return } diff --git a/pages/root.go b/pages/root.go index 594ccfd..0eec9ac 100644 --- a/pages/root.go +++ b/pages/root.go @@ -14,5 +14,5 @@ func RootPage(w http.ResponseWriter, r *http.Request) { return } - templates.RootPage(username).Render(r.Context(), w) + templates.RootPage(username, false).Render(r.Context(), w) } diff --git a/pages/templates/login.templ b/pages/templates/login.templ index a0ea5ae..d6f5857 100644 --- a/pages/templates/login.templ +++ b/pages/templates/login.templ @@ -1,6 +1,6 @@ package templates -templ loginSkeleton() { +templ loginSkeleton(basic_css bool) { @@ -8,7 +8,11 @@ templ loginSkeleton() { - + if basic_css { + + } else { + + } @@ -20,32 +24,34 @@ templ loginSkeleton() { } -templ LoginPage() { - @loginSkeleton() { +templ LoginPage(basic_css bool) { + @loginSkeleton(basic_css) {
-

Login

+

Welcome

-
-
- +
+ + -
+
-
- + + - -
+
+ + +
- - Create Account + + No Account? Create one!
} } -templ CreateAccountBox() { - @loginSkeleton() { +templ CreateAccountBox(basic_css bool) { + @loginSkeleton(basic_css) {

Create Account

diff --git a/pages/templates/login_templ.go b/pages/templates/login_templ.go index f18ccd1..02f587d 100644 --- a/pages/templates/login_templ.go +++ b/pages/templates/login_templ.go @@ -8,7 +8,7 @@ package templates import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" -func loginSkeleton() templ.Component { +func loginSkeleton(basic_css bool) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -26,7 +26,22 @@ func loginSkeleton() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Todo login") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Todo login") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if basic_css { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -42,7 +57,7 @@ func loginSkeleton() templ.Component { }) } -func LoginPage() templ.Component { +func LoginPage(basic_css bool) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -72,13 +87,13 @@ func LoginPage() templ.Component { }() } ctx = templ.InitializeContext(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Login




Create Account
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Welcome

No Account? Create one!
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = loginSkeleton().Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = loginSkeleton(basic_css).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -86,7 +101,7 @@ func LoginPage() templ.Component { }) } -func CreateAccountBox() templ.Component { +func CreateAccountBox(basic_css bool) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -122,7 +137,7 @@ func CreateAccountBox() templ.Component { } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = loginSkeleton().Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = loginSkeleton(basic_css).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/pages/templates/root.templ b/pages/templates/root.templ index 0474f2b..a276472 100644 --- a/pages/templates/root.templ +++ b/pages/templates/root.templ @@ -6,7 +6,7 @@ import ( "github.com/Cameron-Reed1/todo-web/types" ) -templ RootPage(username string) { +templ RootPage(username string, basic_css bool) { @@ -14,7 +14,11 @@ templ RootPage(username string) { - + if basic_css { + + } else { + + } diff --git a/pages/templates/root_templ.go b/pages/templates/root_templ.go index f18d7c8..1ad3046 100644 --- a/pages/templates/root_templ.go +++ b/pages/templates/root_templ.go @@ -14,7 +14,7 @@ import ( "github.com/Cameron-Reed1/todo-web/types" ) -func RootPage(username string) templ.Component { +func RootPage(username string, basic_css bool) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) @@ -32,14 +32,29 @@ func RootPage(username string) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Todo