more fixes
This commit is contained in:
@@ -43,21 +43,18 @@ pub fn render_form(
|
|||||||
.border_style(Style::default().fg(theme.accent))
|
.border_style(Style::default().fg(theme.accent))
|
||||||
.style(Style::default().bg(theme.bg));
|
.style(Style::default().bg(theme.bg));
|
||||||
|
|
||||||
// Center the input box vertically
|
// Place the input container at the top
|
||||||
let vertical_center = Layout::default()
|
let input_container_area = Rect {
|
||||||
.direction(Direction::Vertical)
|
x: columns[1].x,
|
||||||
.constraints([
|
y: columns[1].y,
|
||||||
Constraint::Min(1),
|
width: columns[1].width,
|
||||||
Constraint::Length(fields.len() as u16 + 2), // +2 for borders
|
height: fields.len() as u16 + 2, // +2 for borders
|
||||||
Constraint::Min(1),
|
};
|
||||||
])
|
|
||||||
.split(columns[1]);
|
|
||||||
|
|
||||||
// Render the input container
|
f.render_widget(&input_container, input_container_area);
|
||||||
f.render_widget(&input_container, vertical_center[1]);
|
|
||||||
|
|
||||||
// Input area inside borders
|
// Input area inside borders
|
||||||
let input_area = input_container.inner(vertical_center[1]);
|
let input_area = input_container.inner(input_container_area);
|
||||||
let input_rows = Layout::default()
|
let input_rows = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
.constraints(vec![Constraint::Length(1); fields.len()])
|
.constraints(vec![Constraint::Length(1); fields.len()])
|
||||||
@@ -71,7 +68,7 @@ pub fn render_form(
|
|||||||
)));
|
)));
|
||||||
f.render_widget(label, Rect {
|
f.render_widget(label, Rect {
|
||||||
x: columns[0].x,
|
x: columns[0].x,
|
||||||
y: vertical_center[1].y + 1 + i as u16, // Align with input rows
|
y: input_container_area.y + 1 + i as u16, // Align with input rows
|
||||||
width: columns[0].width,
|
width: columns[0].width,
|
||||||
height: 1,
|
height: 1,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user