From 3637edb816f673830b70b05354a5b74909549999 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Sun, 28 Apr 2024 01:13:27 +0200 Subject: Start work on styling --- view/components.templ | 51 +++++++++++++++++++++++++++++++++++++++++++++++ view/login.templ | 55 ++++++++++++++++++++++++++++++++++++++------------- view/main.templ | 11 ++++++++++- 3 files changed, 102 insertions(+), 15 deletions(-) create mode 100644 view/components.templ (limited to 'view') diff --git a/view/components.templ b/view/components.templ new file mode 100644 index 0000000..b2383ba --- /dev/null +++ b/view/components.templ @@ -0,0 +1,51 @@ +package view + +templ textLikeField(fieldType string, name string, placeholder string) { + +} + +templ TextField(name string, placeholder string) { + @textLikeField("text", name, placeholder) +} + +templ PasswordField(name string, placeholder string) { + @textLikeField("password", name, placeholder) +} + +templ Button(fieldType string, name string, attrs templ.Attributes) { + +} + +templ SecondaryButton(fieldType string, name string, attrs templ.Attributes) { + +} diff --git a/view/login.templ b/view/login.templ index 56e003c..1beb1d6 100644 --- a/view/login.templ +++ b/view/login.templ @@ -5,25 +5,52 @@ import ( ) templ LoginFormError(currentUser *model.User, err string) { -
if currentUser == nil { -
-

- - - - if err != "" { - { err } - } -

-
+ } else { -

Signed in as { currentUser.Name }

+
+

Prout prout

+
+

Signed in as { currentUser.Name }

+ @SecondaryButton("button", "Sign out", templ.Attributes{ + "hx-post": "/logout", + "hx-refresh": true, + }) +
+
} -
} templ LoginForm(currentUser *model.User) { @LoginFormError(currentUser, "") } - diff --git a/view/main.templ b/view/main.templ index 4ae917b..04751b1 100644 --- a/view/main.templ +++ b/view/main.templ @@ -14,7 +14,16 @@ templ Main(contents templ.Component, currentUser *model.User) { - + @LoginForm(currentUser) @contents -- cgit