Add box around /me

This commit is contained in:
Joscha 2024-03-09 19:02:39 +01:00
parent db2766bbb4
commit 7aa192047b

View file

@ -140,10 +140,14 @@ impl Drawer {
.node() .node()
.with_border_all(length(1.0)) .with_border_all(length(1.0))
.with_padding_horiz(length(1.0)) .with_padding_horiz(length(1.0))
.with_margin_right(length(4.0))
.with_flex_shrink(0.0) // Avoid wrapping .with_flex_shrink(0.0) // Avoid wrapping
.and_child(username) .and_child(username)
.register(&mut tree)?; .register(&mut tree)?;
let content = if let Some(content) = content.strip_prefix("/me") {
let content = content.trim_start();
let content = Text::new() let content = Text::new()
.and_plain(content) .and_plain(content)
.widget(&mut self.ctx.font_stuff) .widget(&mut self.ctx.font_stuff)
@ -151,17 +155,32 @@ impl Drawer {
.with_max_size_height(length(max_content_height_in_lines * 16.0)) .with_max_size_height(length(max_content_height_in_lines * 16.0))
.register(&mut tree)?; .register(&mut tree)?;
let content = Node::empty() Block::new()
.with_border(BLACK)
.node()
.with_border_all(length(1.0))
.with_padding_horiz(length(1.0))
.and_child(content)
.register(&mut tree)?
} else {
let content = Text::new()
.and_plain(content)
.widget(&mut self.ctx.font_stuff)
.node()
.with_max_size_height(length(max_content_height_in_lines * 16.0))
.register(&mut tree)?;
Node::empty()
.with_padding_vert(length(1.0)) .with_padding_vert(length(1.0))
.and_child(content) .and_child(content)
.register(&mut tree)?; .register(&mut tree)?
};
let root = Node::empty() let root = Node::empty()
.with_size_width(percent(1.0)) .with_size_width(percent(1.0))
.with_padding_vert(length(1.0)) .with_padding_vert(length(1.0))
.with_flex_direction(FlexDirection::Row) .with_flex_direction(FlexDirection::Row)
.with_align_items(Some(AlignItems::Start)) .with_align_items(Some(AlignItems::Start))
.with_gap_width(length(4.0))
.and_child(username) .and_child(username)
.and_child(content) .and_child(content)
.register(&mut tree)?; .register(&mut tree)?;