Atlas - layout.py

Home / systems / linux / intranet / web-management-core / core Lines: 1 | Size: 1119 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1from fastapi import Request 2 3STYLE = """ 4<style> 5html, body { 6 background: #000000; 7 color: #ffffff; 8 font-family: monospace; 9 margin: 0; 10 padding: 0.5em; 11} 12 13a { 14 color: #4da6ff; 15 text-decoration: none; 16} 17 18a:hover { 19 text-decoration: underline; 20} 21 22.header { 23 margin-bottom: 0.5em; 24} 25 26hr { 27 border: none; 28 border-top: 1px solid #444; 29 margin: 0.5em 0; 30} 31 32pre { 33 white-space: pre-wrap; 34} 35 36input, textarea { 37 background: #000000; 38 color: #ffffff; 39 border: 1px solid #444; 40 font-family: monospace; 41 padding: 0.2em; 42} 43 44input[type=submit] { 45 width: auto; 46} 47 48textarea { 49 width: 100%; 50 height: 6em; 51} 52 53.center { 54 text-align: center; 55} 56</style> 57""" 58 59def layout(request: Request, title: str, buttons: list[tuple[str, str]], header_html: str | None, body_html: str) -> str: 60 nav = " ".join(f"<a href='{href}'>[{label}]</a>" for label, href in buttons) 61 header = header_html if header_html is not None else f"<div class='header'>{nav} {title}</div>" 62 return f""" 63 <html> 64 <head>{STYLE}</head> 65 <body> 66 {header} 67 <hr /> 68 {body_html} 69 </body> 70 </html> 71 """ 72
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.