-
Notifications
You must be signed in to change notification settings - Fork 2
/
container.go
92 lines (70 loc) · 1.69 KB
/
container.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Code generated by go generate; DO NOT EDIT.
package uikit
import (
"github.com/maxence-charriere/go-app/v7/pkg/app"
)
// UIContainer is a component that allows you to align and center your page content
type UIContainer interface {
app.UI
// Class adds a CSS class to the container.
Class(v string) UIContainer
// Content sets the main content.
Content(elems ...app.UI) UIContainer
// Expand if you do not want to limit the container width but still want the dynamic horizontal padding.
Expand() UIContainer
// Large for a large container.
Large() UIContainer
// Small for a small container.
Small() UIContainer
// XLarge for a xlarge container.
XLarge() UIContainer
// XSmall for a xsmall container.
XSmall() UIContainer
}
type container struct {
app.Compo
Iclass string
Icontent []app.UI
}
// Container returns a container component.
func Container() UIContainer {
return &container{
Iclass: "uk-container",
}
}
func (c *container) Class(v string) UIContainer {
if c.Iclass != "" {
c.Iclass += " "
}
c.Iclass += v
return c
}
func (c *container) Content(elems ...app.UI) UIContainer {
c.Icontent = app.FilterUIElems(elems...)
return c
}
func (c *container) Expand() UIContainer {
c.Class("uk-container-expand")
return c
}
func (c *container) Large() UIContainer {
c.Class("uk-container-large")
return c
}
func (c *container) Small() UIContainer {
c.Class("uk-container-small")
return c
}
func (c *container) XLarge() UIContainer {
c.Class("uk-container-xlarge")
return c
}
func (c *container) XSmall() UIContainer {
c.Class("uk-container-xsmall")
return c
}
func (c *container) Render() app.UI {
return app.Div().
Class(c.Iclass).
Body(c.Icontent...)
}