-
Notifications
You must be signed in to change notification settings - Fork 2
/
lightbox.go
66 lines (50 loc) · 1.23 KB
/
lightbox.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
// Code generated by go generate; DO NOT EDIT.
package uikit
import (
"github.com/maxence-charriere/go-app/v7/pkg/app"
)
// UILightbox is a component that creates a responsive lightbox gallery with images and videos
type UILightbox interface {
app.UI
// Class adds a CSS class to the lightbox.
Class(v string) UILightbox
// Content sets the main content.
Content(elems ...app.UI) UILightbox
// Option sets a component option.
Option(k string, v interface{}) UILightbox
}
type lightbox struct {
app.Compo
Iclass string
Icontent []app.UI
Ioptions map[string]interface{}
}
// Lightbox returns a lightbox component.
func Lightbox() UILightbox {
return &lightbox{}
}
func (l *lightbox) Class(v string) UILightbox {
if l.Iclass != "" {
l.Iclass += " "
}
l.Iclass += v
return l
}
func (l *lightbox) Content(elems ...app.UI) UILightbox {
l.Icontent = app.FilterUIElems(elems...)
return l
}
func (l *lightbox) Option(k string, v interface{}) UILightbox {
if l.Ioptions == nil {
l.Ioptions = make(map[string]interface{}, 0)
}
l.Ioptions[k] = v
return l
}
func (l *lightbox) Render() app.UI {
opts, _ := JSONString(l.Ioptions)
return app.Div().
DataSet("uk-lightbox", opts).
Class(l.Iclass).
Body(l.Icontent...)
}