Layout using new algorithm and new blocks
This commit is contained in:
parent
6f4d94afa5
commit
ae8ec70e5e
7 changed files with 459 additions and 254 deletions
24
src/ui/chat/tree/widgets.rs
Normal file
24
src/ui/chat/tree/widgets.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use crate::store::Msg;
|
||||
use crate::ui::widgets::join::{HJoin, Segment};
|
||||
use crate::ui::widgets::padding::Padding;
|
||||
use crate::ui::widgets::text::Text;
|
||||
use crate::ui::widgets::BoxedWidget;
|
||||
|
||||
use super::time;
|
||||
|
||||
pub fn msg<M: Msg>(highlighted: bool, indent: usize, msg: &M) -> BoxedWidget {
|
||||
HJoin::new(vec![
|
||||
Segment::new(Padding::new(time::widget(Some(msg.time()), highlighted)).right(1)),
|
||||
Segment::new(Padding::new(Text::new(msg.nick())).right(1)),
|
||||
Segment::new(Text::new(msg.content()).wrap(true)),
|
||||
])
|
||||
.into()
|
||||
}
|
||||
|
||||
pub fn msg_placeholder(highlighted: bool, indent: usize) -> BoxedWidget {
|
||||
HJoin::new(vec![
|
||||
Segment::new(Padding::new(time::widget(None, highlighted)).right(1)),
|
||||
Segment::new(Text::new("[...]")),
|
||||
])
|
||||
.into()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue