mirror of
https://codeberg.org/unspeaker/perch.git
synced 2025-12-06 17:46:42 +01:00
refactor layout
This commit is contained in:
parent
48f651fc0f
commit
52102d771d
1 changed files with 22 additions and 20 deletions
42
src/view.rs
42
src/view.rs
|
|
@ -13,14 +13,27 @@ impl Taggart {
|
|||
|
||||
impl Content<TuiOut> for Taggart {
|
||||
fn content (&self) -> impl Render<TuiOut> {
|
||||
let size = format!("{}x{}", self.display.w(), self.display.h());
|
||||
let sizer = Fill::xy(&self.display);
|
||||
let titlebar = status_bar(
|
||||
let w = self.display.w();
|
||||
let h = self.display.h();
|
||||
let sizer = Fill::xy(&self.display);
|
||||
let value_bar = |x|Bsp::n(self.value_bar(), x);
|
||||
let mode_bar = |x|Bsp::n(self.mode_bar(format!("{w}x{h}")), x);
|
||||
let title_bar = |x|Bsp::s(self.title_bar(), x);
|
||||
let sized = |x|Bsp::b(sizer, Fill::xy(x));
|
||||
value_bar(mode_bar(title_bar(sized(TreeTable(self)))))
|
||||
}
|
||||
}
|
||||
|
||||
impl Taggart {
|
||||
fn title_bar (&self) -> impl Content<TuiOut> {
|
||||
status_bar(
|
||||
Color::Rgb(0, 0, 0),
|
||||
Color::Rgb(192, 192, 192),
|
||||
Align::w(self.columns.header())
|
||||
);
|
||||
let value_bar = status_bar(
|
||||
)
|
||||
}
|
||||
fn value_bar (&self) -> impl Content<TuiOut> {
|
||||
status_bar(
|
||||
Color::Rgb(192, 192, 192),
|
||||
Color::Rgb(0, 0, 0),
|
||||
Fill::x(
|
||||
|
|
@ -39,8 +52,10 @@ impl Content<TuiOut> for Taggart {
|
|||
)))
|
||||
)
|
||||
)
|
||||
);
|
||||
let mode_bar = status_bar(
|
||||
)
|
||||
}
|
||||
fn mode_bar (&self, size: String) -> impl Content<TuiOut> {
|
||||
status_bar(
|
||||
Color::Rgb(0, 0, 0),
|
||||
Color::Rgb(192, 192, 192),
|
||||
Fill::x(Bsp::a(
|
||||
|
|
@ -58,19 +73,6 @@ impl Content<TuiOut> for Taggart {
|
|||
}))),
|
||||
Fill::x(Align::e(size)),
|
||||
))
|
||||
);
|
||||
Bsp::n(
|
||||
value_bar,
|
||||
Bsp::n(
|
||||
mode_bar,
|
||||
Bsp::s(
|
||||
titlebar,
|
||||
Bsp::b(
|
||||
sizer,
|
||||
Fill::xy(TreeTable(self))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue