small fix

This commit is contained in:
Dominic Ferrando
2025-04-17 07:35:28 -04:00
parent 598eeb0a60
commit 24bb9af073
6 changed files with 90 additions and 9 deletions
+23 -3
View File
@@ -51,9 +51,12 @@ body {
width: 300px; width: 300px;
} }
.new-thread-btn { .new-thread-container {
display: block; width: max-content;
margin: auto; margin: auto;
}
#newThreadBtn {
margin-top: 12px; margin-top: 12px;
background: none; background: none;
border: none; border: none;
@@ -64,10 +67,27 @@ body {
cursor: pointer; cursor: pointer;
} }
.new-thread-btn:hover { #newThreadBtn:hover {
color: #ff0000 color: #ff0000
} }
.new-thread-form-field {}
.new-thread-form-field th {
border: 1px solid black;
text-align: left;
vertical-align: middle;
padding: 4px;
background: #98E;
font-weight: bold;
font-size: .8rem;
}
.new-thread-form-field td {
display: block;
margin: 2px;
}
/* GENERAL LAYOUT */ /* GENERAL LAYOUT */
.container { .container {
+1
View File
@@ -0,0 +1 @@
const $ = (id) => document.getElementById(id);
+23 -1
View File
@@ -2,6 +2,25 @@ package boards
import "github.com/dominicf2001/comfychan/web/views/shared" import "github.com/dominicf2001/comfychan/web/views/shared"
templ NewThreadForm() {
<form style="display: none;" id="newThreadForm" style="display: ;">
<div>
<table>
<tbody>
<tr class="new-thread-form-field">
<th>Subject</th>
<td><input/></td>
</tr>
<tr class="new-thread-form-field">
<th>Comment</th>
<td><textarea></textarea></td>
</tr>
</tbody>
</table>
</div>
</form>
}
templ Comfy() { templ Comfy() {
@shared.Layout() { @shared.Layout() {
<header class="board-header"> <header class="board-header">
@@ -11,6 +30,9 @@ templ Comfy() {
</h1> </h1>
<p>Be comfy fren</p> <p>Be comfy fren</p>
</header> </header>
<button class="new-thread-btn">[New Thread]</button> <div class="new-thread-container">
<button _="on click hide me then show #newThreadForm" id="newThreadBtn">[New Thread]</button>
@NewThreadForm()
</div>
} }
} }
+41 -4
View File
@@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
import "github.com/dominicf2001/comfychan/web/views/shared" import "github.com/dominicf2001/comfychan/web/views/shared"
func Comfy() templ.Component { func NewThreadForm() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@@ -31,7 +31,36 @@ func Comfy() templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent templ_7745c5c3_Var1 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form style=\"display: none;\" id=\"newThreadForm\" style=\"display: ;\"><div><table><tbody><tr class=\"new-thread-form-field\"><th>Subject</th><td><input></td></tr><tr class=\"new-thread-form-field\"><th>Comment</th><td><textarea></textarea></td></tr></tbody></table></div></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
func Comfy() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer { if !templ_7745c5c3_IsBuffer {
@@ -43,13 +72,21 @@ func Comfy() templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<header class=\"board-header\"><img src=\"/static/img/banner-comfy.png\"><h1>\"/comfy/\" - Comfy</h1><p>Be comfy fren</p></header><button class=\"new-thread-btn\">[New Thread]</button>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<header class=\"board-header\"><img src=\"/static/img/banner-comfy.png\"><h1>\"/comfy/\" - Comfy</h1><p>Be comfy fren</p></header><div class=\"new-thread-container\"><button _=\"on click hide me then show #newThreadForm\" id=\"newThreadBtn\">[New Thread]</button>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = NewThreadForm().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
return nil return nil
}) })
templ_7745c5c3_Err = shared.Layout().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer) templ_7745c5c3_Err = shared.Layout().Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
+1
View File
@@ -6,6 +6,7 @@ templ Layout() {
<head> <head>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<title>Comfychan</title> <title>Comfychan</title>
<script src="https://unpkg.com/hyperscript.org@0.9.14"></script>
<link rel="stylesheet" href="/static/reset.css"/> <link rel="stylesheet" href="/static/reset.css"/>
<link rel="stylesheet" href="/static/index.css"/> <link rel="stylesheet" href="/static/index.css"/>
</head> </head>
+1 -1
View File
@@ -29,7 +29,7 @@ func Layout() templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent templ_7745c5c3_Var1 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><title>Comfychan</title><link rel=\"stylesheet\" href=\"/static/reset.css\"><link rel=\"stylesheet\" href=\"/static/index.css\"></head><body><div id=\"boardList\"><span>[ <a href=\"/\">index</a> ]</span> <span>[ <a href=\"/comfy\">comfy</a> / <a href=\"#\">r9k</a> ]</span></div>") templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><title>Comfychan</title><script src=\"https://unpkg.com/hyperscript.org@0.9.14\"></script><link rel=\"stylesheet\" href=\"/static/reset.css\"><link rel=\"stylesheet\" href=\"/static/index.css\"></head><body><div id=\"boardList\"><span>[ <a href=\"/\">index</a> ]</span> <span>[ <a href=\"/comfy\">comfy</a> / <a href=\"#\">r9k</a> ]</span></div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }