add chat example

This commit is contained in:
maddalax 2024-10-04 10:38:15 -05:00
parent caad5633d0
commit f65c5b303e
3 changed files with 9 additions and 3 deletions

View file

@ -14,7 +14,7 @@ RUN go mod download
COPY . .
# Build the Go binary for Linux
RUN CGO_ENABLED=0 GOPRIVATE=github.com/maddalax LOG_LEVEL=debug go run github.com/maddalax/htmgo/cli/htmgo@8b816e956692683337d9fff6416ccc31f5047b59 build
RUN CGO_ENABLED=0 GOPRIVATE=github.com/maddalax LOG_LEVEL=debug go run github.com/maddalax/htmgo/cli/htmgo@latest build
RUN CGO_ENABLED=1 GOOS=linux go build -tags prod -o ./dist -a -ldflags '-linkmode external -extldflags "-static"' .

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View file

@ -14,6 +14,12 @@ type Example struct {
}
var examples = []Example{
{
Title: "Chat App Example",
Github: "https://github.com/maddalax/htmgo/tree/master/examples/chat",
Demo: "https://chat-example.htmgo.dev",
Image: "public/chat-example.jpg",
},
{
Title: "Todo List MVC",
Github: "https://github.com/maddalax/htmgo/tree/master/examples/todo-list",
@ -67,10 +73,10 @@ func ExamplesPage(ctx *h.RequestContext) *h.Page {
func ExampleCards() *h.Element {
return h.Div(
h.Class("prose-h2:my-1 prose-img:my-1 flex flex-col md:flex-row gap-6 md:gap-2 text-center pb-8"), // Left-aligns and allows multiple cards in a row
h.Class("prose-h2:my-1 prose-img:my-1 grid grid-cols-1 md:grid-cols-3 gap-6 text-center pb-8"), // Using grid for 3-column layout
h.List(examples, func(example Example, index int) *h.Element {
return h.Div(
h.Class("border border-gray-200 shadow-sm rounded-md px-4 pb-4 w-full md:w-1/2 bg-neutral-100"), // Reduces padding
h.Class("border border-gray-200 shadow-sm rounded-md px-4 pb-4 bg-neutral-100"), // Removed specific width, handled by grid
h.Div(
h.Class("flex flex-col gap-1 mt-4"),
h.H2(