From 574695bfb01184f23663b875b09ab9a0c8a3b66f Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Thu, 11 Jul 2024 08:08:58 -0700 Subject: [PATCH] moved view components out of internal and added some more --- .../views => components}/bulma/button.templ | 26 +++++----- .../views => components}/bulma/card.templ | 0 .../bulma/form/control.templ | 0 .../bulma/form/field.templ | 0 components/bulma/form/input.templ | 15 ++++++ .../bulma/form/label.templ | 0 components/bulma/form/new.templ | 13 +++++ components/bulma/form/select.templ | 33 +++++++++++++ .../bulma/form/submit.templ | 0 components/bulma/form/textarea.templ | 5 ++ components/bulma/form/util.go | 8 +++ .../views => components}/bulma/hero.templ | 0 components/bulma/notification.templ | 7 +++ .../views => components}/bulma/section.templ | 0 components/bulma/tags.templ | 13 +++++ components/bulma/title.templ | 49 +++++++++++++++++++ {internal/views => components}/bulma/util.go | 4 ++ components/templ-html/br.templ | 5 ++ components/templ-html/href.templ | 9 ++++ internal/views/articles/list.templ | 7 ++- internal/views/bulma/form/input.templ | 9 ---- internal/views/bulma/form/new.templ | 7 --- internal/views/bulma/form/util.go | 6 --- internal/views/home/index.templ | 2 +- internal/views/sources/add.templ | 19 ++++--- internal/views/sources/addAfter.templ | 11 +++++ internal/views/sources/listAll.templ | 10 +++- internal/views/users/afterLogin.templ | 13 +++-- internal/views/users/afterSignUp.templ | 10 ++-- internal/views/users/login copy.templ | 18 ++++--- internal/views/users/logout.templ | 2 +- internal/views/users/profile.templ | 18 ++++--- internal/views/users/signup.templ | 35 +++++++------ 33 files changed, 261 insertions(+), 93 deletions(-) rename {internal/views => components}/bulma/button.templ (55%) rename {internal/views => components}/bulma/card.templ (100%) rename {internal/views => components}/bulma/form/control.templ (100%) rename {internal/views => components}/bulma/form/field.templ (100%) create mode 100644 components/bulma/form/input.templ rename {internal/views => components}/bulma/form/label.templ (100%) create mode 100644 components/bulma/form/new.templ create mode 100644 components/bulma/form/select.templ rename {internal/views => components}/bulma/form/submit.templ (100%) create mode 100644 components/bulma/form/textarea.templ create mode 100644 components/bulma/form/util.go rename {internal/views => components}/bulma/hero.templ (100%) create mode 100644 components/bulma/notification.templ rename {internal/views => components}/bulma/section.templ (100%) create mode 100644 components/bulma/tags.templ create mode 100644 components/bulma/title.templ rename {internal/views => components}/bulma/util.go (71%) create mode 100644 components/templ-html/br.templ create mode 100644 components/templ-html/href.templ delete mode 100644 internal/views/bulma/form/input.templ delete mode 100644 internal/views/bulma/form/new.templ delete mode 100644 internal/views/bulma/form/util.go create mode 100644 internal/views/sources/addAfter.templ diff --git a/internal/views/bulma/button.templ b/components/bulma/button.templ similarity index 55% rename from internal/views/bulma/button.templ rename to components/bulma/button.templ index 865a605..5385978 100644 --- a/internal/views/bulma/button.templ +++ b/components/bulma/button.templ @@ -1,21 +1,18 @@ package bulma -templ Button(color string, isLight, isDark bool) { - if isLight { - - } - if isDark { - - } - if !isLight && !isDark { - +} + +// Used to create a button and lets you define the color. +// Accepts children. +templ ButtonColor(color string) { + - } } templ ButtonNewTab(url, text string) { @@ -24,7 +21,6 @@ templ ButtonNewTab(url, text string) { } - templ ALink(url, title string) { { title } } diff --git a/internal/views/bulma/card.templ b/components/bulma/card.templ similarity index 100% rename from internal/views/bulma/card.templ rename to components/bulma/card.templ diff --git a/internal/views/bulma/form/control.templ b/components/bulma/form/control.templ similarity index 100% rename from internal/views/bulma/form/control.templ rename to components/bulma/form/control.templ diff --git a/internal/views/bulma/form/field.templ b/components/bulma/form/field.templ similarity index 100% rename from internal/views/bulma/form/field.templ rename to components/bulma/form/field.templ diff --git a/components/bulma/form/input.templ b/components/bulma/form/input.templ new file mode 100644 index 0000000..d793c66 --- /dev/null +++ b/components/bulma/form/input.templ @@ -0,0 +1,15 @@ +package form + +templ TextInput(color, id, fieldType, placeholder string) { + if color == "" { + + } else { + + } +} + +templ Checkbox(text, id string) { + +} diff --git a/internal/views/bulma/form/label.templ b/components/bulma/form/label.templ similarity index 100% rename from internal/views/bulma/form/label.templ rename to components/bulma/form/label.templ diff --git a/components/bulma/form/new.templ b/components/bulma/form/new.templ new file mode 100644 index 0000000..8f5029e --- /dev/null +++ b/components/bulma/form/new.templ @@ -0,0 +1,13 @@ +package form + +type NewParam struct { + HxPost string +} + +templ New(param NewParam) { + if param.HxPost != "" { +
+ { children... } +
+ } +} diff --git a/components/bulma/form/select.templ b/components/bulma/form/select.templ new file mode 100644 index 0000000..8adffdc --- /dev/null +++ b/components/bulma/form/select.templ @@ -0,0 +1,33 @@ +package form + +templ SelectOne(color string, isRound bool) { + if isRound { +
+ +
+ } else { +
+ +
+ } +} + +templ SelectOneItem(name string) { + +} + +templ SelectMany(howManySelectable int, color string, isRound bool) { +
+ +
+} + +templ SelectManyItem(name string) { + +} diff --git a/internal/views/bulma/form/submit.templ b/components/bulma/form/submit.templ similarity index 100% rename from internal/views/bulma/form/submit.templ rename to components/bulma/form/submit.templ diff --git a/components/bulma/form/textarea.templ b/components/bulma/form/textarea.templ new file mode 100644 index 0000000..d922742 --- /dev/null +++ b/components/bulma/form/textarea.templ @@ -0,0 +1,5 @@ +package form + +templ TextArea(id, placeholder, color string) { +