feat: display color-coded word cards on index page

This commit is contained in:
Grail Finder (aider)
2025-05-01 18:16:56 +03:00
parent 024dbcffc2
commit 7ebd0db05a
2 changed files with 18 additions and 3 deletions

View File

@ -7,7 +7,22 @@
<script src="https://unpkg.com/htmx.org@1.9.10"></script> <script src="https://unpkg.com/htmx.org@1.9.10"></script>
</head> </head>
<body> <body>
<h1>HTMX + Go Starter</h1> <h1>Word Color Cards</h1>
<p>Edit this HTML in templates/public/index.html</p> <div style="display: flex; gap: 1rem; flex-wrap: wrap; padding: 1rem;">
{{range $word, $color := .}}
<div style="
background-color: {{$color}};
padding: 1rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
min-width: 100px;
text-align: center;
color: white;
text-shadow: 0 1px 2px rgba(0,0,0,0.25);
">
{{$word}}
</div>
{{end}}
</div>
</body> </body>
</html> </html>

View File

@ -19,5 +19,5 @@ func HandlePing(w http.ResponseWriter, r *http.Request) {
func HandleHome(w http.ResponseWriter, r *http.Request) { func HandleHome(w http.ResponseWriter, r *http.Request) {
tmpl := template.Must(template.ParseFiles("../components/index.html")) tmpl := template.Must(template.ParseFiles("../components/index.html"))
tmpl.Execute(w, nil) tmpl.Execute(w, roundWords)
} }