1
0
Fork 0
forked from goffee/core

dropdown, href is content

This commit is contained in:
Diana 2024-10-15 16:07:18 -05:00
parent a904773bab
commit f398ebb02d
5 changed files with 20 additions and 20 deletions

View 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
}

View file

@ -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>

View file

@ -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

View file

@ -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}}

View file

@ -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
}