pub fn table<M>() -> El<M>Expand description
table.
Examples found in repository?
examples/table.rs (line 62)
47fn view(entries: &[Entry]) -> View {
48 let head = html::tr()
49 .child(html::th("Name"))
50 .child(html::th("Size").class("size"));
51 let rows = entries.iter().map(|e| {
52 let name = if e.dir {
53 format!("{}/", e.name)
54 } else {
55 e.name.clone()
56 };
57 let size = if e.dir { "-".to_owned() } else { human(e.size) };
58 html::tr()
59 .child(html::td(name).class(if e.dir { "dir" } else { "file" }))
60 .child(html::td(size).class("size"))
61 });
62 View::new().main([html::table()
63 .class("ls")
64 .child(html::thead().child(head))
65 .child(html::tbody().children(rows))])
66}