proper-website-2/components/homepanel.go

41 lines
1.2 KiB
Go
Raw Normal View History

2022-03-01 17:07:33 +01:00
package components
import "github.com/maxence-charriere/go-app/v9/pkg/app"
type homePanel struct {
app.Compo
2022-03-02 13:38:28 +01:00
2022-03-12 15:52:13 +01:00
onShowClick func()
updateAvailable bool
2022-03-01 17:07:33 +01:00
}
func newHomePanel() *homePanel {
return &homePanel{}
}
func (p *homePanel) Render() app.UI {
return app.Div().Body(
2022-03-01 19:45:23 +01:00
app.P().Text("Welcome, internet surfer!").Class("p-h1"),
app.Raw(`<p>This website is my creative outlet and a way of expressing myself.
2022-03-01 17:07:33 +01:00
As of now, it's probably the most impressive thing I've ever coded.
2022-03-01 19:45:23 +01:00
<br><br>
2022-03-12 21:19:17 +01:00
Please enjoy yourself and do sign the guestbook!!</p>`),
2022-03-12 15:52:13 +01:00
app.If(p.updateAvailable,
app.Div().Body(
app.P().Text("An update is available! Reload to update!!"),
)),
2022-03-01 19:45:23 +01:00
app.Div().Body(
app.P().Text("Please sign my guestbook!").Style("font-size", "0.8em"),
app.Img().Src("/web/static/images/email3.gif").Style("width", "40px").Style("position", "absolute").Style("bottom", "0px").Style("right", "0px"),
2022-03-02 13:38:28 +01:00
).Style("position", "absolute").Style("bottom", "5px").Style("right", "5px").
OnClick(func(ctx app.Context, e app.Event) {
e.PreventDefault()
p.onShowClick()
}),
2022-03-01 17:07:33 +01:00
).Class("content")
}
2022-03-12 15:52:13 +01:00
func (p *homePanel) OnAppUpdate(ctx app.Context) {
p.updateAvailable = true
}