feat: render sections
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-05-09 17:39:00 +02:00
parent 81f1f8ee60
commit 0406fbe14d
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
2 changed files with 15 additions and 4 deletions

View File

@ -2,5 +2,7 @@
- [x] Display todos as todos - [x] Display todos as todos
- [ ] Create sections - [ ] Create sections
- [ ] Edit todos
- [ ] Move items
- [ ] Display summaries and limit todos - [ ] Display summaries and limit todos
- [ ] Implement scroll - [ ] Implement scroll

View File

@ -285,8 +285,17 @@ impl StatefulWidget for &mut CreateItem {
type State = CreateItemState; type State = CreateItemState;
fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) { fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {
let chunks = let chunks = Layout::vertical(vec![
Layout::vertical(vec![Constraint::Length(3), Constraint::Length(3)]).split(area); Constraint::Length(2),
Constraint::Length(3),
Constraint::Length(3),
])
.split(area);
let path = format!("path: {}.{}", state.root, state.path.join("."));
let path_header = Paragraph::new(path).dark_gray();
path_header.render(chunks[0], buf);
let mut title_input = InputField::new("title"); let mut title_input = InputField::new("title");
let mut description_input = InputField::new("description"); let mut description_input = InputField::new("description");
@ -295,8 +304,8 @@ impl StatefulWidget for &mut CreateItem {
CreateItemFocused::Description => description_input.focused = true, CreateItemFocused::Description => description_input.focused = true,
} }
title_input.render(chunks[0], buf, &mut state.title); title_input.render(chunks[1], buf, &mut state.title);
description_input.render(chunks[1], buf, &mut state.description); description_input.render(chunks[2], buf, &mut state.description);
// let title = Paragraph::new("something"); //.block(block); // let title = Paragraph::new("something"); //.block(block);