-
Notifications
You must be signed in to change notification settings - Fork 2
/
article.go
52 lines (40 loc) · 910 Bytes
/
article.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
// Code generated by go generate; DO NOT EDIT.
package uikit
import (
"github.com/maxence-charriere/go-app/v7/pkg/app"
)
// UIArticle is a component that consists of the article itself, a title and meta data
type UIArticle interface {
app.UI
// Class adds a CSS class to the article.
Class(v string) UIArticle
// Content sets the main content.
Content(elems ...app.UI) UIArticle
}
type article struct {
app.Compo
Iclass string
Icontent []app.UI
}
// Article returns a article component.
func Article() UIArticle {
return &article{
Iclass: "uk-article",
}
}
func (a *article) Class(v string) UIArticle {
if a.Iclass != "" {
a.Iclass += " "
}
a.Iclass += v
return a
}
func (a *article) Content(elems ...app.UI) UIArticle {
a.Icontent = app.FilterUIElems(elems...)
return a
}
func (a *article) Render() app.UI {
return app.Article().
Class(a.Iclass).
Body(a.Icontent...)
}