dropdown, href is content
This commit is contained in:
parent
a904773bab
commit
f398ebb02d
5 changed files with 20 additions and 20 deletions
15
template/components/content_dropdown.go
Normal file
15
template/components/content_dropdown.go
Normal file
|
@ -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
|
||||||
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
{{define "form_dropdown_item"}}
|
{{define "content_dropdown_item"}}
|
||||||
<li><a class="dropdown-item {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}" href="{{.Link}}">{{.Text}}</a></li>
|
<li><a class="dropdown-item {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}" href="{{.Link}}">{{.Text}}</a></li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{define "form_dropdown"}}
|
{{define "content_dropdown"}}
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-{{.TypeClass}} dropdown-toggle {{if eq .IsDisabled true}}disabled{{end}}" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<button class="btn btn-{{.TypeClass}} dropdown-toggle {{if eq .IsDisabled true}}disabled{{end}}" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
{{.Label}}
|
{{.Label}}
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
{{ range .Items}}
|
{{ range .Items}}
|
||||||
{{template "form_dropdown_item" .}}
|
{{template "content_dropdown_item" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
|
@ -1,6 +1,6 @@
|
||||||
package components
|
package components
|
||||||
|
|
||||||
type FormHref struct {
|
type ContentHref struct {
|
||||||
Text string
|
Text string
|
||||||
Link string
|
Link string
|
||||||
Icon string
|
Icon string
|
|
@ -1,4 +1,4 @@
|
||||||
{{define "form_href"}}
|
{{define "content_href"}}
|
||||||
<a class="{{if eq .IsButton true}} btn btn-{{.TypeClass}}{{end}} {{if eq .IsDisabled true}}disabled{{end}}"
|
<a class="{{if eq .IsButton true}} btn btn-{{.TypeClass}}{{end}} {{if eq .IsDisabled true}}disabled{{end}}"
|
||||||
href="{{.Link}}" {{if eq .IsButton true}}role="button"{{end}} {{if eq .IsDisabled true}}aria-disabled="true"{{end}}>
|
href="{{.Link}}" {{if eq .IsButton true}}role="button"{{end}} {{if eq .IsDisabled true}}aria-disabled="true"{{end}}>
|
||||||
{{.Text}}
|
{{.Text}}
|
|
@ -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
|
|
||||||
}
|
|
Loading…
Reference in a new issue