From 1fc32c9857e68087792e0f9c06dc565bc8af601b Mon Sep 17 00:00:00 2001 From: Thomas Nilles Date: Sun, 11 Jan 2026 14:52:28 -0500 Subject: [PATCH] Serve static files at root; add ColorPicker README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change FileServer base path to “/” to serve static assets from the site root. - Remove the unused helloHandler route registration. - Add README documentation for the new ColorPicker web component. --- cmd/app/main.go | 8 +---- static/components/color-picker/README.md | 41 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 static/components/color-picker/README.md diff --git a/cmd/app/main.go b/cmd/app/main.go index 5da6887..48264b7 100644 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -16,21 +16,15 @@ func main() { r.Use(middleware.Recoverer) // Register the hello world handler at the root path - r.Get("/", helloHandler) // Serve static HTML files from the "static" directory // (e.g., /static/index.html will be accessible at /static/index.html) - FileServer(r, "/static", http.Dir("./static")) + FileServer(r, "/", http.Dir("./static")) // Start the HTTP server http.ListenAndServe(":8080", r) } -// helloHandler responds with a simple "Hello, World!" message. -func helloHandler(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("Hello, World!")) -} - // FileServer sets up a http.FileServer handler for serving static files. func FileServer(r chi.Router, publicPath string, root http.FileSystem) { if publicPath == "" { diff --git a/static/components/color-picker/README.md b/static/components/color-picker/README.md new file mode 100644 index 0000000..62f2dfb --- /dev/null +++ b/static/components/color-picker/README.md @@ -0,0 +1,41 @@ +# ColorPicker Component + +## Overview +`ColorPicker` is a custom HTML web component that provides a simple UI for selecting a background color. +The component renders a native `` element and forwards the chosen color via a custom +`colorchange` event. + +## Usage +```html + + + +``` + +## API +| Attribute / Property | Type | Description | +|----------------------|--------|-----------------------------------------------| +| `value` (attr) | string | Hex color string (e.g., `#ff0000`). Default is `#ffffff`. | +| `value` (prop) | string | Same as above, but as a JavaScript property. | + +### Events +| Event | Detail | Description | +|-------------|----------------------------|-------------| +| `colorchange` | `{color: string}` (hex) | Fired whenever the user selects a new color. | + +## Example +```html + + + +``` + +## Change Log +| Date | Author | Change | +|------------|--------|--------| +| 2026‑01‑11 | Thomas | Initial component documentation. | \ No newline at end of file