proper-website-2/components/homepanel.go

50 lines
1.6 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 (p *homePanel) Render() app.UI {
2022-03-14 20:32:35 +01:00
return app.Div().
Class("flex flex-nowrap text-aliceblue").
Body(
app.Div().
Class("flex-auto").
Body(
app.P().Text("Welcome, internet surfer!").Class("p-h1"),
app.P().
Class("").
Text(`Welcome to my website! Whether you came here by accident or were linked to it, I welcome you!
Have a look around my page to see all the stuff I put on it!
I put in a lot of effort, probably the most out of any project I have attempted, so it would be nice
if you left a nice comment down in the guestbook.
There is no signup required (unlike the stupid modern web where that's "essential").
Go crazy, write whatever you want! Just be nice!
Above all, enjoy yourself in my little online webspace!!!`),
app.If(p.updateAvailable,
app.Div().Body(
app.P().
Class("content-text").
Text("An update is available! Reload to update!"),
)),
),
2022-03-12 15:52:13 +01:00
app.Div().Body(
2022-03-14 20:32:35 +01:00
app.P().Text("Please sign my guestbook!").Class("small"),
app.Img().Src("/web/static/images/email3.gif").Style("width", "40px").Style("position", "absolute").Style("bottom", "0px").Style("right", "0px"),
).Style("position", "absolute").Style("bottom", "5px").Style("right", "5px").
OnClick(func(ctx app.Context, e app.Event) {
e.PreventDefault()
p.onShowClick()
}),
).Class("content")
2022-03-01 17:07:33 +01:00
}
2022-03-12 15:52:13 +01:00
func (p *homePanel) OnAppUpdate(ctx app.Context) {
p.updateAvailable = true
}