mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-16 08:20:39 +08:00
patch-list: Simplify layout
This commit is contained in:
+31
-3
@@ -8,13 +8,18 @@ pub struct AppHeader {
|
||||
pub line: Rect,
|
||||
}
|
||||
|
||||
pub struct DefaultPage {
|
||||
pub struct FullPage {
|
||||
pub navigation: Rect,
|
||||
pub component: Rect,
|
||||
pub context: Rect,
|
||||
pub shortcuts: Rect,
|
||||
}
|
||||
|
||||
pub struct DefaultPage {
|
||||
pub component: Rect,
|
||||
pub context: Rect,
|
||||
}
|
||||
|
||||
pub struct IssuePage {
|
||||
pub header: Rect,
|
||||
pub left: Rect,
|
||||
@@ -91,7 +96,7 @@ pub fn app_header(area: Rect, info_w: u16) -> AppHeader {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_page(area: Rect, shortcuts_h: u16) -> DefaultPage {
|
||||
pub fn full_page(area: Rect, shortcuts_h: u16) -> FullPage {
|
||||
let nav_h = 3u16;
|
||||
let context_h = 1u16;
|
||||
let margin_h = 1u16;
|
||||
@@ -113,7 +118,7 @@ pub fn default_page(area: Rect, shortcuts_h: u16) -> DefaultPage {
|
||||
)
|
||||
.split(area);
|
||||
|
||||
DefaultPage {
|
||||
FullPage {
|
||||
navigation: layout[0],
|
||||
component: layout[1],
|
||||
context: layout[2],
|
||||
@@ -121,6 +126,29 @@ pub fn default_page(area: Rect, shortcuts_h: u16) -> DefaultPage {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_page(area: Rect) -> DefaultPage {
|
||||
let context_h = 1u16;
|
||||
let margin_h = 1u16;
|
||||
let component_h = area.height.saturating_sub(context_h);
|
||||
|
||||
let layout = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.horizontal_margin(margin_h)
|
||||
.constraints(
|
||||
[
|
||||
Constraint::Length(component_h),
|
||||
Constraint::Length(context_h),
|
||||
]
|
||||
.as_ref(),
|
||||
)
|
||||
.split(area);
|
||||
|
||||
DefaultPage {
|
||||
component: layout[0],
|
||||
context: layout[1],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn headerless_page(area: Rect) -> Vec<Rect> {
|
||||
let margin_h = 1u16;
|
||||
let content_h = area.height.saturating_sub(margin_h);
|
||||
|
||||
Reference in New Issue
Block a user