1use aetna_core::prelude::*;
8
9fn modal_fixture() -> El {
10 stack([
11 column([
12 h1("Account"),
13 titled_card(
14 "Profile",
15 [
16 row([text("Email"), spacer(), text("user@example.com").muted()]),
17 row([text("Plan"), spacer(), badge("Pro").info()]),
18 ],
19 ),
20 titled_card(
21 "Danger zone",
22 [row([
23 column([
24 text("Delete account").bold(),
25 text("Remove this account and all associated data.")
26 .muted()
27 .small(),
28 ])
29 .gap(tokens::SPACE_1)
30 .align(Align::Start)
31 .width(Size::Hug),
32 spacer(),
33 button("Delete").destructive().key("open-delete"),
34 ])],
35 ),
36 ])
37 .gap(tokens::SPACE_4)
38 .padding(tokens::SPACE_7),
39 modal(
40 "delete-account",
41 "Delete account?",
42 [
43 text("Permanent action. Export data first.").muted(),
44 row([
45 spacer(),
46 button("Cancel").ghost().key("cancel-delete"),
47 button("Delete").destructive().key("confirm-delete"),
48 ])
49 .gap(tokens::SPACE_2),
50 ],
51 ),
52 ])
53}
54
55fn main() -> std::io::Result<()> {
56 let mut root = modal_fixture();
57 let viewport = Rect::new(0.0, 0.0, 720.0, 560.0);
58 let bundle = render_bundle(&mut root, viewport);
59
60 let out_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("out");
61 let written = write_bundle(&bundle, &out_dir, "modal")?;
62 for p in &written {
63 println!("wrote {}", p.display());
64 }
65
66 if !bundle.lint.findings.is_empty() {
67 eprintln!("\nlint findings ({}):", bundle.lint.findings.len());
68 eprint!("{}", bundle.lint.text());
69 }
70
71 Ok(())
72}