Skip to content

Commit

Permalink
Add big text title 'Glues' to entry view
Browse files Browse the repository at this point in the history
  • Loading branch information
panarch committed Oct 12, 2024
1 parent c404b16 commit b2cb132
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 10 deletions.
69 changes: 63 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ratatui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ async-io = "2.3.2"
ratatui = "0.28.1"
color-eyre = "0.6.3"
edtui = "0.7.2"
tui-big-text = "0.6.0"
15 changes: 11 additions & 4 deletions ratatui/src/views/body/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@ use {
glues_core::state::EntryState,
ratatui::{
layout::{Alignment, Constraint::Length, Flex, Layout, Rect},
style::{Color, Style},
style::{Color, Style, Stylize},
widgets::{Block, HighlightSpacing, List, ListDirection, Padding},
Frame,
},
tui_big_text::BigText,
};

pub fn draw(frame: &mut Frame, area: Rect, _state: &EntryState, context: &mut EntryContext) {
let [area] = Layout::horizontal([Length(24)])
let [area] = Layout::horizontal([Length(38)])
.flex(Flex::Center)
.areas(area);
let [title_area, area] = Layout::vertical([Length(9), Length(9)])
.flex(Flex::Center)
.areas(area);
let [area] = Layout::vertical([Length(9)]).flex(Flex::Center).areas(area);

let title = BigText::builder()
.lines(vec!["Glues".dark_gray().into()])
.build();
let block = Block::bordered()
.padding(Padding::new(2, 2, 1, 1))
.title("[Glues] Open Notes")
.title("Open Notes")
.title_alignment(Alignment::Center);

let items = ["Instant", "CSV", "JSON", "File", "Git"];
Expand All @@ -28,5 +34,6 @@ pub fn draw(frame: &mut Frame, area: Rect, _state: &EntryState, context: &mut En
.highlight_spacing(HighlightSpacing::Always)
.direction(ListDirection::TopToBottom);

frame.render_widget(title, title_area);
frame.render_stateful_widget(list, area, &mut context.list_state);
}

0 comments on commit b2cb132

Please sign in to comment.