code wiki / _hdl_build / nx_grid_app_demo.nx
nx_grid_app_demo.nx source
↩ module page · 18 lines · 1595 B
1// nx_grid_app_demo.nx -- renders the canonical grid use case (a FIXED 200px sidebar + FLUID 1fr content
2// with a gap) to a viewable PNG via the full sovereign pipeline, confirming grid rung 2 (px/fr track
3// sizing + gap) in PIXELS. The page's own <style> supplies the grid + colors. 100% sovereign.
4// license_tier: ORIGINAL
5import "nx_syscalls.nx"
6import "nx_render_html.nx"
7
8func main() -> i64 {
9 let html: *u8 = "<body><h1>Dashboard</h1><style>.shell{display:grid;grid-template-columns:200px 1fr;gap:16px}.nav{background-color:#2b3a55;color:#ffffff;padding-top:10px;padding-left:10px;height:120px}.content{background-color:#eef2f8;padding-top:10px;padding-left:10px;height:120px}</style><div class=\"shell\"><div class=\"nav\">Home Reports Settings Profile Logout</div><div class=\"content\">Welcome back. Your three reports are ready to review. Grid places this fluid column beside the fixed 200px sidebar with a 16px gutter.</div></div></body>\x00" as *u8
10 var hlen: i64 = 0
11 while html[hlen]!=(0 as u8) { hlen=hlen+1 }
12 let nb: i64 = nx_render_html_to_png(html, hlen, "knowledge/status/grid_app_demo.png\x00" as *u8)
13 var k: i64=0; let m: *u8 = "nx_grid_app_demo: rendered \x00" as *u8; while m[k]!=(0 as u8){k=k+1} sys_write(1,m,k)
14 var v: i64=nb; let b: *u8=sys_mmap(16); var n: i64=0; if v==0{b[0]=48;n=1} while v>0{b[n]=(48+(v%10)) as u8;v=v/10;n=n+1} let o: *u8=sys_mmap(16); var j: i64=0; while j<n{o[j]=b[n-1-j];j=j+1} sys_write(1,o,n)
15 sys_write(1, " boxes -> knowledge/status/grid_app_demo.png\n\x00" as *u8, 44)
16 if nb <= 0 { return 1 }
17 return 0
18}