cleanup the intro example

This commit is contained in:
maddalax 2024-10-25 12:39:22 -05:00
parent a2be0e2fca
commit 5a69d9ba20

View file

@ -5,26 +5,22 @@ We give you the utilities to build html using pure go code in a reusable way (go
```go ```go
func DocsPage(ctx *h.RequestContext) *h.Page { func DocsPage(ctx *h.RequestContext) *h.Page {
assets := ctx.Get("embeddedMarkdown").(fs.FS) pages := dirwalk.WalkPages("md/docs")
pages := dirwalk.WalkPages("md/docs", assets) return h.NewPage(
return h.NewPage(base.RootPage(
h.Div( h.Div(
h.Class("flex flex-col md:flex-row gap-4 justify-center mb-12"), h.Class("flex flex-col md:flex-row gap-4"),
partials.DocSidebar(pages), DocSidebar(pages),
h.Div( h.Div(
h.Class("flex flex-col justify-center items-center mt-6"), h.Class("flex flex-col justify-center items-center mt-6"),
h.List(pages, func(page *dirwalk.Page, index int) *h.Element { h.List(pages, func(page *dirwalk.Page, index int) *h.Element {
return h.Div( return h.Div(
h.Class("border-b border-b-slate-300 w-full pb-8 mb-8"), h.Class("border-b border-b-slate-300"),
MarkdownContent(ctx, MarkdownContent(ctx, page),
page.FilePath,
partials.CreateAnchor(page.Parts)),
) )
}), }),
), ),
), ),
)) )
} }
``` ```