forked from maxence-charriere/go-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
support.go
184 lines (171 loc) · 3.68 KB
/
support.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
package main
import "github.com/gabstv/go-app/v9/pkg/app"
const (
supportUsIconSize = 60
)
type supportUs struct {
app.Compo
}
func newSupportUs() *supportUs {
return &supportUs{}
}
func (s *supportUs) Render() app.UI {
return app.Div().
ID("support-go-app").
Body(
app.Div().
Class("hspace-out").
Body(
app.Header().
Class("h2").
Class("header-separator").
Text("Support go-app"),
app.P().Body(
app.Text("Hello there, I'am Maxence, the creator of "),
app.B().Text("go-app"),
app.Text("."),
),
app.P().Body(
app.Text("Let's go straight to the point: "),
app.Strong().Text("I want to make this package become something big!"),
),
app.P().Body(
app.A().
Href(buyMeACoffeeURL).
Target("_blank").
Text("Buying me a coffee"),
app.Text(", being part of the "),
app.A().
Href(openCollectiveURL).
Target("_blank").
Text("Open Collective"),
app.Text(", sponsoring me on "),
app.A().
Href(githubSponsorURL).
Target("_blank").
Text("GitHub"),
app.Text(", or giving me some cryptocurrencies, all would help me reach that goal, sustain the development, and boost motivation during long coding sessions."),
),
),
app.Flow().
Class("space-flow").
StrechtOnSingleRow().
Content(
app.Div().
Class("space-flow-item").
Body(
newSupportUsItem().
Class("fill").
Label("Buy me a coffee").
Href(buyMeACoffeeURL).
Icon(
newSVGIcon().
RawSVG(coffeeSVG).
Size(supportUsIconSize),
),
),
app.Div().
Class("space-flow-item").
Body(
newSupportUsItem().
Class("fill").
Label("Donate cryptos").
Href(coinbaseBusinessURL).
Icon(
newSVGIcon().
RawSVG(bitcoinSVG).
Size(supportUsIconSize),
),
),
app.Div().
Class("space-flow-item").
Body(
newSupportUsItem().
Class("fill").
Label("Github sponsor").
Href(githubSponsorURL).
Icon(
newSVGIcon().
RawSVG(githubSVG).
Size(supportUsIconSize),
),
),
app.Div().
Class("space-flow-item").
Body(
newSupportUsItem().
Class("fill").
Label("Open collective").
Href(openCollectiveURL).
Icon(
newSVGIcon().
RawSVG(opensourceSVG).
Size(supportUsIconSize),
),
),
),
)
}
type supportUsItem struct {
app.Compo
Iclass string
Ilabel string
Ihref string
Iicon app.UI
}
func newSupportUsItem() *supportUsItem {
return &supportUsItem{}
}
func (i *supportUsItem) Class(v string) *supportUsItem {
if v == "" {
return i
}
if i.Iclass != "" {
i.Iclass += " "
}
i.Iclass += v
return i
}
func (i *supportUsItem) Label(v string) *supportUsItem {
i.Ilabel = v
return i
}
func (i *supportUsItem) Href(v string) *supportUsItem {
i.Ihref = v
return i
}
func (i *supportUsItem) Icon(v app.UI) *supportUsItem {
i.Iicon = v
return i
}
func (i *supportUsItem) Render() app.UI {
return app.A().
Class("support-us-item").
Class("hspace-in-stretch").
Class("vspace-in").
Class("vignette").
Class("magnify").
Class(i.Iclass).
Href(i.Ihref).
Body(
app.Stack().
Class("fill").
Center().
Middle().
Content(
app.Div().Body(
app.Div().
Class("fit").
Class("center").
Body(i.Iicon),
app.Div().
Class("support-us-item-label").
Class("heading").
Class("default").
Class("fit").
Class("center").
Text(i.Ilabel),
),
),
)
}