From db799805f9c4aa700be0c92fe74a3b2affcc5c1a Mon Sep 17 00:00:00 2001 From: Preston Baxter Date: Sat, 28 Oct 2023 11:34:11 -0500 Subject: [PATCH] B: get to login page --- ui/.air.toml | 2 +- ui/main.go | 8 ++ ui/templates/footer.templ | 46 +++++++++++ .../{content.templ => landing_content.templ} | 2 +- ui/templates/landing_page.templ | 3 +- ui/templates/login_content.templ | 78 +++++++++++++++++++ ui/templates/login_page.templ | 14 ++++ 7 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 ui/templates/footer.templ rename ui/templates/{content.templ => landing_content.templ} (99%) create mode 100644 ui/templates/login_content.templ create mode 100644 ui/templates/login_page.templ diff --git a/ui/.air.toml b/ui/.air.toml index 23dc2de..7e46587 100644 --- a/ui/.air.toml +++ b/ui/.air.toml @@ -5,7 +5,7 @@ tmp_dir = "tmp" [build] args_bin = [] bin = "./tmp/main" - cmd = "templ generate && go build -o ./tmp/main ." + cmd = "rm **/*_templ.go && templ generate && go build -o ./tmp/main ." delay = 1000 exclude_dir = ["assets", "tmp", "vendor", "testdata", "dist"] exclude_file = [] diff --git a/ui/main.go b/ui/main.go index e5a440d..9cbfc06 100644 --- a/ui/main.go +++ b/ui/main.go @@ -15,6 +15,14 @@ func main() { templates.LandingPage(false).Render(c.Request.Context(), buf) + c.Data(200, "text/html", []byte(buf.String())) + }) + r.GET("/login", func(c *gin.Context) { + raw := []byte{} + buf := bytes.NewBuffer(raw) + templates.LoginPage().Render(c.Request.Context(), buf) + + c.Data(200, "text/html", []byte(buf.String())) }) r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080") diff --git a/ui/templates/footer.templ b/ui/templates/footer.templ new file mode 100644 index 0000000..24101fa --- /dev/null +++ b/ui/templates/footer.templ @@ -0,0 +1,46 @@ +package templates + +templ Footer() { + +} diff --git a/ui/templates/content.templ b/ui/templates/landing_content.templ similarity index 99% rename from ui/templates/content.templ rename to ui/templates/landing_content.templ index a33c5bf..b88a102 100644 --- a/ui/templates/content.templ +++ b/ui/templates/landing_content.templ @@ -1,6 +1,6 @@ package templates -templ Content() { +templ LandingContent() {
@Nav(auth) - @Content() + @LandingContent() + @Footer() @toggleNavBar() } diff --git a/ui/templates/login_content.templ b/ui/templates/login_content.templ new file mode 100644 index 0000000..a0c7a11 --- /dev/null +++ b/ui/templates/login_content.templ @@ -0,0 +1,78 @@ +package templates + +templ LoginContent() { +
+
+
+
+
+
+
+
+
+ Sign in +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+
+} diff --git a/ui/templates/login_page.templ b/ui/templates/login_page.templ new file mode 100644 index 0000000..6aa1480 --- /dev/null +++ b/ui/templates/login_page.templ @@ -0,0 +1,14 @@ +package templates + +templ LoginPage() { + + + @Head() + + @Nav(false) + @LoginContent() + + @Footer() + @toggleNavBar() + +}