lookbook/internal/components/page.go
soup fc625fb9cf
Initial lookbook implementation
Pinterest-style visual bookmarking app with:
- URL metadata extraction (OG/Twitter meta, oEmbed fallback)
- Image caching in Postgres with 480px thumbnails
- Multi-tag filtering with Ctrl/Cmd for OR mode
- Fuzzy tag suggestions and inline tag editing
- Browser console auth() with first-use password setup
- Brutalist UI with Commit Mono font and Pico CSS
- Light/dark mode via browser preference
2026-01-16 21:14:23 -05:00

51 lines
1.2 KiB
Go

package components
import (
"git.soup.land/soup/sxgo/ssr"
)
type Page struct {
Title string
Content ssr.Renderable
ShowNav bool
HasAuth bool
}
func (p Page) Render(sw *ssr.Writer) error {
sw.Tmpl(p, `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="light dark">
<meta name="darkreader-lock">
<title>{{.Title}} - Lookbook</title>
<link rel="stylesheet" href="{{staticURL "css/pico.min.css"}}">
<link rel="stylesheet" href="{{staticURL "css/styles.css"}}">
</head>
<body>
<header class="site-header">
<div class="title">Lookbook</div>
{{if .ShowNav}}
<nav class="site-nav">
<a href="/">All</a>
<button type="button" class="ghost" onclick="auth()">Auth</button>
<button type="button" class="ghost" onclick="logout()" {{if not .HasAuth}}hidden{{end}}>Logout</button>
</nav>
{{end}}
</header>
<main class="container">
`)
p.Content.Render(sw)
return sw.Tmpl(p, `
</main>
<script>
window.LOOKBOOK_AUTH = {{if .HasAuth}}true{{else}}false{{end}};
</script>
<script src="{{staticURL "js/app.js"}}"></script>
</body>
</html>
`)
}