diff --git a/components/aboutpage.go b/components/aboutpage.go new file mode 100644 index 0000000..7c5fc8e --- /dev/null +++ b/components/aboutpage.go @@ -0,0 +1,31 @@ +package components + +import "github.com/maxence-charriere/go-app/v9/pkg/app" + +type AboutPage struct { + app.Compo +} + +func NewAboutPage() *AboutPage { + return &AboutPage{} +} + +func (a *AboutPage) Render() app.UI { + return app.Div().Body( + &header{}, + app.Div().Body( + newNavbar(), + &aboutPanel{}, + ).Class("main"), + ) +} + +type aboutPanel struct { + app.Compo +} + +func (a *aboutPanel) Render() app.UI { + return app.Div().Body( + app.Raw(`
I am a 21 year old computer science student, living and studying in The Netherlands.
`), + ).Class("content") +} diff --git a/components/content-view.go b/components/content-view.go new file mode 100644 index 0000000..790248d --- /dev/null +++ b/components/content-view.go @@ -0,0 +1,23 @@ +package components + +import ( + "github.com/maxence-charriere/go-app/v9/pkg/app" +) + +type contentView struct { + app.Compo + + panels []app.UI +} + +func newContentView(panels ...app.UI) *contentView { + return &contentView{panels: panels} +} + +func (c *contentView) Render() app.UI { + return app.Div().Body( + app.Range(c.panels).Slice(func(i int) app.UI { + return c.panels[i] + }), + ) +} diff --git a/components/homepage.go b/components/homepage.go index 4d46fc1..add9107 100644 --- a/components/homepage.go +++ b/components/homepage.go @@ -6,24 +6,24 @@ import ( type Homepage struct { app.Compo + + content *contentView } func NewHomepage() *Homepage { - return &Homepage{} + p1 := newHomePanel() + c := newContentView(p1) + return &Homepage{content: c} } func (p *Homepage) Render() app.UI { return app.Div().Body( &header{}, app.Div().Body( - app.Div().Body( - app.Ul().Body( - app.Li().Body( - app.A().Href("/").Text("Home"), - ), - ), - ).Class("navbar"), - app.Div().Text("Dit is test tekst voor in de div content").Class("content"), + newNavbar(), + newHomePanel(), + newHomePanel(), + newHomePanel(), ).Class("main"), ) } diff --git a/components/homepanel.go b/components/homepanel.go new file mode 100644 index 0000000..378e124 --- /dev/null +++ b/components/homepanel.go @@ -0,0 +1,21 @@ +package components + +import "github.com/maxence-charriere/go-app/v9/pkg/app" + +type homePanel struct { + app.Compo +} + +func newHomePanel() *homePanel { + return &homePanel{} +} + +func (p *homePanel) Render() app.UI { + return app.Div().Body( + app.Raw(`Welcome to my website, internet traveler!
+This website is my creative outlet and a way of expressing myself.
+As of now, it's probably the most impressive thing I've ever coded.
+
+Please enjoy yourself and do sign the guestbook!!