1use aetna_core::prelude::*;
15
16fn settings() -> El {
17 column([
18 h1("Settings"),
19 titled_card(
20 "Account",
21 [
22 row([text("Email"), spacer(), text("user@example.com").muted()]),
23 row([
24 text("Two-factor authentication"),
25 spacer(),
26 badge("Enabled").success(),
27 ]),
28 row([
29 text("Recovery codes"),
30 spacer(),
31 button("Generate").secondary(),
32 ]),
33 ],
34 ),
35 titled_card(
36 "Appearance",
37 [
38 row([text("Theme"), spacer(), button("Dark").secondary()]),
39 row([text("Compact mode"), spacer(), badge("Off").muted()]),
40 row([text("Font size"), spacer(), text("14")]),
41 ],
42 ),
43 titled_card(
44 "Danger zone",
45 [row([
46 column([
47 text("Delete account").bold(),
48 text("Permanently remove your account and all data.")
49 .muted()
50 .small(),
51 ])
52 .gap(tokens::SPACE_1)
53 .align(Align::Start)
54 .width(Size::Hug),
55 spacer(),
56 button("Delete").destructive(),
57 ])],
58 ),
59 row([spacer(), button("Cancel").ghost(), button("Save").primary()]),
60 ])
61 .gap(tokens::SPACE_4)
62 .padding(tokens::SPACE_7)
63}
64
65fn main() -> std::io::Result<()> {
66 let mut root = settings();
67
68 let viewport = Rect::new(0.0, 0.0, 720.0, 760.0);
69 let bundle = render_bundle(&mut root, viewport);
70
71 let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
72 let written = write_bundle(&bundle, &out_dir, "settings")?;
73 for p in &written {
74 println!("wrote {}", p.display());
75 }
76
77 if !bundle.lint.findings.is_empty() {
78 eprintln!("\nlint findings ({}):", bundle.lint.findings.len());
79 eprint!("{}", bundle.lint.text());
80 }
81
82 Ok(())
83}