this repo has no description
at export-config 53 lines 1.6 kB view raw
1import { html } from "hono/html"; 2import type { HtmlEscapedString } from "hono/utils/html"; 3import type { Session } from "../../lib/session"; 4 5interface LayoutOptions { 6 title?: string; 7 session?: Session; 8 csrfToken?: string; 9} 10 11type Content = string | HtmlEscapedString | Promise<HtmlEscapedString>; 12 13export function layout(content: Content, options: LayoutOptions = {}) { 14 const { title = "sitebase", session } = options; 15 16 return html` 17 <!DOCTYPE html> 18 <html lang="en"> 19 <head> 20 <meta charset="UTF-8" /> 21 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 22 <title>${title}</title> 23 <link rel="stylesheet" href="/public/styles.css" /> 24 </head> 25 <body> 26 <header class="header"> 27 <nav class="nav"> 28 <a href="/" class="logo">sitebase</a> 29 <div class="nav-links"> 30 ${ 31 session?.did 32 ? html` 33 <a href="/publication">Publication</a> 34 <a href="/documents">Documents</a> 35 <span class="handle">@${session.handle}</span> 36 <a href="/auth/logout">Logout</a> 37 ` 38 : html` <a href="/auth/login">Login with Bluesky</a> ` 39 } 40 </div> 41 </nav> 42 </header> 43 <main class="main">${content}</main> 44 <footer class="footer"> 45 <p> 46 sitebase - Manage your 47 <a href="https://standard.site">standard.site</a> content 48 </p> 49 </footer> 50 </body> 51 </html> 52 `; 53}