From a904773babab29b9e24d40cf183b8a7a1ee92f0e Mon Sep 17 00:00:00 2001 From: Diana Date: Tue, 15 Oct 2024 16:06:49 -0500 Subject: [PATCH 1/5] Badge --- template/components/content_badge.go | 7 +++++++ template/components/content_badge.html | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 template/components/content_badge.go create mode 100644 template/components/content_badge.html diff --git a/template/components/content_badge.go b/template/components/content_badge.go new file mode 100644 index 0000000..7da7147 --- /dev/null +++ b/template/components/content_badge.go @@ -0,0 +1,7 @@ +package components + +type ContentBadge struct { + Text string + TypeClass string // type primary, secondary, success, danger, warning, info, light, dark, (default secondary) + IsOutline bool +} diff --git a/template/components/content_badge.html b/template/components/content_badge.html new file mode 100644 index 0000000..6f72cf7 --- /dev/null +++ b/template/components/content_badge.html @@ -0,0 +1,7 @@ +{{define "content_badge"}} + {{.Text}} +{{end}} \ No newline at end of file From f398ebb02dbc0d9510dab1f2588ffd0b5f6c1405 Mon Sep 17 00:00:00 2001 From: Diana Date: Tue, 15 Oct 2024 16:07:18 -0500 Subject: [PATCH 2/5] dropdown, href is content --- template/components/content_dropdown.go | 15 +++++++++++++++ .../{form_dropdown.html => content_dropdown.html} | 6 +++--- .../components/{form_href.go => content_href.go} | 2 +- .../{form_href.html => content_href.html} | 2 +- template/components/form_dropdown.go | 15 --------------- 5 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 template/components/content_dropdown.go rename template/components/{form_dropdown.html => content_dropdown.html} (79%) rename template/components/{form_href.go => content_href.go} (88%) rename template/components/{form_href.html => content_href.html} (88%) delete mode 100644 template/components/form_dropdown.go diff --git a/template/components/content_dropdown.go b/template/components/content_dropdown.go new file mode 100644 index 0000000..1040060 --- /dev/null +++ b/template/components/content_dropdown.go @@ -0,0 +1,15 @@ +package components + +type ContentDropdown struct { + Label string + TypeClass string // type primary, secondary, success, danger, warning, info, light, dark, link, outline-primary + IsDisabled bool + Items []ContentDropdownItem +} + +type ContentDropdownItem struct { + Text string + Link string + IsDisabled bool + IsActive bool +} diff --git a/template/components/form_dropdown.html b/template/components/content_dropdown.html similarity index 79% rename from template/components/form_dropdown.html rename to template/components/content_dropdown.html index 2c6827b..ce83a26 100644 --- a/template/components/form_dropdown.html +++ b/template/components/content_dropdown.html @@ -1,15 +1,15 @@ -{{define "form_dropdown_item"}} +{{define "content_dropdown_item"}}
  • {{.Text}}
  • {{end}} -{{define "form_dropdown"}} +{{define "content_dropdown"}} diff --git a/template/components/form_href.go b/template/components/content_href.go similarity index 88% rename from template/components/form_href.go rename to template/components/content_href.go index 25dbee3..143ca80 100644 --- a/template/components/form_href.go +++ b/template/components/content_href.go @@ -1,6 +1,6 @@ package components -type FormHref struct { +type ContentHref struct { Text string Link string Icon string diff --git a/template/components/form_href.html b/template/components/content_href.html similarity index 88% rename from template/components/form_href.html rename to template/components/content_href.html index dc9adb3..f4980ac 100644 --- a/template/components/form_href.html +++ b/template/components/content_href.html @@ -1,4 +1,4 @@ -{{define "form_href"}} +{{define "content_href"}} {{.Text}} diff --git a/template/components/form_dropdown.go b/template/components/form_dropdown.go deleted file mode 100644 index b80d8f1..0000000 --- a/template/components/form_dropdown.go +++ /dev/null @@ -1,15 +0,0 @@ -package components - -type FormDropdown struct { - Label string - TypeClass string - IsDisabled bool - Items []FormDropdownItem -} - -type FormDropdownItem struct { - Text string - Link string - IsDisabled bool - IsActive bool -} From 458ad520ca19f7301741fcc02b9c6a6306157837 Mon Sep 17 00:00:00 2001 From: Diana Date: Tue, 15 Oct 2024 16:09:17 -0500 Subject: [PATCH 3/5] Input required, table (class, href, badge) --- template/components/content_table.go | 15 +++++++++------ template/components/content_table.html | 19 ++++++++++++++++--- template/components/form_input.go | 1 + template/components/form_input.html | 3 +++ template/components/page_nav.go | 2 +- template/components/page_nav.html | 2 +- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/template/components/content_table.go b/template/components/content_table.go index 66c7e1f..1cb7024 100644 --- a/template/components/content_table.go +++ b/template/components/content_table.go @@ -1,17 +1,20 @@ package components type ContentTable struct { - ID string - AllTH []ContentTableTH - AllTD [][]ContentTableTD + ID string + TableClass string // table-primary, table-secondary,.. table-striped table-bordered + HeadClass string // table-dark table-light + AllTH []ContentTableTH + AllTD [][]ContentTableTD } type ContentTableTH struct { - ID string - Value string + ID string + ValueType string // -> default string, href, badge + Value string } type ContentTableTD struct { ID string - Value string + Value interface{} // string or component struct according ValueType } diff --git a/template/components/content_table.html b/template/components/content_table.html index 68e34f6..ce19344 100644 --- a/template/components/content_table.html +++ b/template/components/content_table.html @@ -1,12 +1,25 @@ {{define "content_table"}} - - +
    + {{range $index, $col := .AllTH}}{{end}} -{{range .AllTD}}{{range .}}{{end}}{{end}} + {{range .AllTD}} + {{range $index, $item := .}} + {{end}} + {{end}}
    {{ $col.Value }}
    {{ .Value }}
    + {{ with $x := index $.AllTH $index }} + {{ if eq $x.ValueType "href"}} + {{template "content_href" $item.Value}} + {{ else if eq $x.ValueType "badge"}} + {{template "content_badge" $item.Value}} + {{ else }} + {{ $item.Value }} + {{end}} + {{end}} +
    {{end}} \ No newline at end of file diff --git a/template/components/form_input.go b/template/components/form_input.go index 0ce7ce4..e27910f 100644 --- a/template/components/form_input.go +++ b/template/components/form_input.go @@ -9,4 +9,5 @@ type FormInput struct { Hint string Error string IsDisabled bool + IsRequired bool } diff --git a/template/components/form_input.html b/template/components/form_input.html index b79ae87..8159896 100644 --- a/template/components/form_input.html +++ b/template/components/form_input.html @@ -5,6 +5,9 @@ {{if eq .IsDisabled true}} disabled {{end}} + {{if eq .IsRequired true}} + required + {{end}} {{if ne .Value ""}} value="{{.Value}}" {{end}} diff --git a/template/components/page_nav.go b/template/components/page_nav.go index 2ed9319..862d1c8 100644 --- a/template/components/page_nav.go +++ b/template/components/page_nav.go @@ -1,7 +1,7 @@ package components type PageNav struct { - NavClass string // nav-pills + NavClass string // nav-pills, nav-underline NavItems []PageNavItem IsVertical bool IsTab bool diff --git a/template/components/page_nav.html b/template/components/page_nav.html index 5bb0b83..08faaf4 100644 --- a/template/components/page_nav.html +++ b/template/components/page_nav.html @@ -8,7 +8,7 @@ class="nav-link dropdown-toggle {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}">{{$item.Text}}
    From bf84e14bb12060a12d9e6581a39b26547823a92c Mon Sep 17 00:00:00 2001 From: Diana Date: Tue, 15 Oct 2024 16:09:31 -0500 Subject: [PATCH 4/5] component list --- template/components/content_list.go | 19 +++++++++++++++++++ template/components/content_list.html | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 template/components/content_list.go create mode 100644 template/components/content_list.html diff --git a/template/components/content_list.go b/template/components/content_list.go new file mode 100644 index 0000000..34bfb49 --- /dev/null +++ b/template/components/content_list.go @@ -0,0 +1,19 @@ +package components + +type ContentList struct { + Items []ContentListItem +} + +type ContentListItem struct { + Text string + Description string + EndElement string + //Link string + TypeClass string // primary, secondary, success, danger, warning, info, light, dark + IsDisabled bool + //IsActive bool +} + +//link +//border +// badge diff --git a/template/components/content_list.html b/template/components/content_list.html new file mode 100644 index 0000000..31af60b --- /dev/null +++ b/template/components/content_list.html @@ -0,0 +1,14 @@ +{{define "content_list"}} +
      + {{ range .Items}} +
    • {{.Text}}

      {{.EndElement}}
      + {{.Description}} +
    • + {{end}} +
    + + + +{{end}} \ No newline at end of file From be138b2fb4b5e983a35129a598e3a11a8c01e337 Mon Sep 17 00:00:00 2001 From: Zeni Kim Date: Tue, 15 Oct 2024 22:15:20 -0500 Subject: [PATCH 5/5] add middle line --- template/components/content_table.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/template/components/content_table.html b/template/components/content_table.html index ce19344..2bf559d 100644 --- a/template/components/content_table.html +++ b/template/components/content_table.html @@ -6,7 +6,7 @@ - {{range .AllTD}} + {{- range .AllTD}} {{range $index, $item := .}} {{ with $x := index $.AllTH $index }} {{ if eq $x.ValueType "href"}} @@ -19,7 +19,7 @@ {{end}} {{end}} - {{end}} + {{- end}} -{{end}} \ No newline at end of file +{{end}}