-
Notifications
You must be signed in to change notification settings - Fork 2
/
marker.go
66 lines (50 loc) · 1.19 KB
/
marker.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"
)
// UIMarker is a component that creates a marker icon that can be displayed on top of images
type UIMarker interface {
app.UI
// Class adds a CSS class to the marker.
Class(v string) UIMarker
// Content sets the main content.
Content(elems ...app.UI) UIMarker
// Option sets a component option.
Option(k string, v interface{}) UIMarker
}
type marker struct {
app.Compo
Iclass string
Icontent []app.UI
Ioptions map[string]interface{}
}
// Marker returns a marker component.
func Marker() UIMarker {
return &marker{}
}
func (m *marker) Class(v string) UIMarker {
if m.Iclass != "" {
m.Iclass += " "
}
m.Iclass += v
return m
}
func (m *marker) Content(elems ...app.UI) UIMarker {
m.Icontent = app.FilterUIElems(elems...)
return m
}
func (m *marker) Option(k string, v interface{}) UIMarker {
if m.Ioptions == nil {
m.Ioptions = make(map[string]interface{}, 0)
}
m.Ioptions[k] = v
return m
}
func (m *marker) Render() app.UI {
opts, _ := JSONString(m.Ioptions)
return app.A().
DataSet("uk-marker", opts).
Class(m.Iclass).
Body(m.Icontent...)
}