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 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/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"}} + + + + +{{end}} \ No newline at end of file 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 f7c2f89..2bf559d 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 +{{end}} 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 -} 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}}