forked from GoAdminGroup/go-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
box.go
54 lines (45 loc) · 1.1 KB
/
box.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package components
import (
"github.com/chenhg5/go-admin/template/types"
"html/template"
)
type BoxAttribute struct {
Name string
Header template.HTML
Body template.HTML
Footer template.HTML
Title template.HTML
Theme string
HeadBorder string
}
func (compo *BoxAttribute) SetTheme(value string) types.BoxAttribute {
compo.Theme = value
return compo
}
func (compo *BoxAttribute) SetHeader(value template.HTML) types.BoxAttribute {
compo.Header = value
return compo
}
func (compo *BoxAttribute) SetBody(value template.HTML) types.BoxAttribute {
compo.Body = value
return compo
}
func (compo *BoxAttribute) SetFooter(value template.HTML) types.BoxAttribute {
compo.Footer = value
return compo
}
func (compo *BoxAttribute) SetTitle(value template.HTML) types.BoxAttribute {
compo.Title = value
return compo
}
func (compo *BoxAttribute) WithHeadBorder(has bool) types.BoxAttribute {
if has {
compo.HeadBorder = "with-border"
} else {
compo.HeadBorder = ""
}
return compo
}
func (compo *BoxAttribute) GetContent() template.HTML {
return ComposeHtml(*compo, "box")
}