From 501efd45d0fc188c980aa4830f255a4dacdbf897 Mon Sep 17 00:00:00 2001 From: early Date: Sun, 25 Aug 2024 00:50:37 -0600 Subject: [PATCH] add a test app --- cmd/standard-test/index.html | 14 ++++++++ cmd/standard-test/main.go | 29 +++++++++++++++++ cmd/standard-test/public/style.css | 51 ++++++++++++++++++++++++++++++ go.mod | 2 ++ go.sum | 2 ++ 5 files changed, 98 insertions(+) create mode 100644 cmd/standard-test/index.html create mode 100644 cmd/standard-test/main.go create mode 100644 cmd/standard-test/public/style.css diff --git a/cmd/standard-test/index.html b/cmd/standard-test/index.html new file mode 100644 index 0000000..ca3b29a --- /dev/null +++ b/cmd/standard-test/index.html @@ -0,0 +1,14 @@ + + +
+ Today Engine Examples + +
+ + +
+ +
+ + + \ No newline at end of file diff --git a/cmd/standard-test/main.go b/cmd/standard-test/main.go new file mode 100644 index 0000000..d2ed56c --- /dev/null +++ b/cmd/standard-test/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "net/http" + "syscall" + + "git.earlybird.gay/today-engine/page" + stdpart "git.earlybird.gay/today-engine/standard/part" + + tapp "git.earlybird.gay/today-app/app" +) + +var Page = page.New("index", "index.html", + page.Includes( + stdpart.ContactForm([]string{"Feedback"}), + ), +) + +func main() { + app := tapp.New() + tapp.GetEnv().Apply(app) + app.ShutdownOnSignal(syscall.SIGINT, syscall.SIGTERM) + + app.Handle("GET /{$}", Page) + app.Handle("GET /", http.FileServer(http.Dir("public"))) + app.Handle("POST /contact", stdpart.HandleContactForm(nil, stdpart.PrintContact)) + + app.ListenAndServe() +} diff --git a/cmd/standard-test/public/style.css b/cmd/standard-test/public/style.css new file mode 100644 index 0000000..c0a3157 --- /dev/null +++ b/cmd/standard-test/public/style.css @@ -0,0 +1,51 @@ +/* The Great Reset */ +* { + padding: 0; + margin: 0; +} + +/* Containers */ + +html { + font-family: sans-serif; +} + +main, section, nav { + display: flex; + flex-direction: column; + gap: 1rem; +} + +main { + margin: 2rem 25%; +} + +span { + display: inline; +} + +span + span { + margin-left: .5rem; +} + +/* Forms */ + +form { + display: grid; + grid-template-columns: 1fr 3fr; + gap: .5rem; +} + +form > input[type="submit"] { + grid-column: span 2; +} + +/* Typography */ + +:not(pre) > code { + font-size: 1rem; +} + +li { + margin-left: 20px; +} \ No newline at end of file diff --git a/go.mod b/go.mod index 27bc819..4a7affa 100644 --- a/go.mod +++ b/go.mod @@ -3,3 +3,5 @@ module git.earlybird.gay/today-engine go 1.22.4 require golang.org/x/net v0.27.0 + +require git.earlybird.gay/today-app v0.0.0-20240813010007-675f08ae35b1 diff --git a/go.sum b/go.sum index 7566714..e4e88d5 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ +git.earlybird.gay/today-app v0.0.0-20240813010007-675f08ae35b1 h1:Fbz2uRIWK6CR+jcNN0KQrna4u/kYZccn2obcla7dPfQ= +git.earlybird.gay/today-app v0.0.0-20240813010007-675f08ae35b1/go.mod h1:AxsoC2ERffYriW60C1vdV34ew6JPKxllG9mHOTs128I= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -- 2.39.5