Skip to content

Commit

Permalink
Implement Rounded corners (#918)
Browse files Browse the repository at this point in the history
* add rounded corners

* more

* apply rounded corners to script boxes as well
  • Loading branch information
nnyyxxxx authored Nov 6, 2024
1 parent e463037 commit c36879e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions tui/src/confirmation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl FloatContent for ConfirmPrompt {
fn draw(&mut self, frame: &mut Frame, area: Rect) {
let block = Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title(" Confirm selections ")
.title_bottom(" [y] to continue, [n] to abort ")
.title_alignment(Alignment::Center)
Expand Down
7 changes: 6 additions & 1 deletion tui/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ impl Filter {

//Create the search bar widget
let search_bar = Paragraph::new(display_text)
.block(Block::default().borders(Borders::ALL).title(" Search "))
.block(
Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title(" Search "),
)
.style(Style::default().fg(search_color));

//Render the search bar (First chunk of the screen)
Expand Down
1 change: 1 addition & 0 deletions tui/src/floating_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ impl FloatContent for FloatingText {
// Define the Block with a border and background color
let block = Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title(self.mode_title.clone())
.title_alignment(ratatui::layout::Alignment::Center)
.title_style(Style::default().reversed())
Expand Down
2 changes: 2 additions & 0 deletions tui/src/running_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl FloatContent for RunningCommand {
// Display a block indicating the command is running
Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title_top(Line::from("Running the command....").centered())
.title_style(Style::default().reversed())
.title_bottom(Line::from("Press Ctrl-C to KILL the command"))
Expand Down Expand Up @@ -80,6 +81,7 @@ impl FloatContent for RunningCommand {

Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.title_top(title_line.centered())
};

Expand Down
37 changes: 22 additions & 15 deletions tui/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,19 @@ impl AppState {
self.drawable = true;
}

let label_block =
Block::default()
.borders(Borders::all())
.border_set(ratatui::symbols::border::Set {
top_left: " ",
top_right: " ",
bottom_left: " ",
bottom_right: " ",
vertical_left: " ",
vertical_right: " ",
horizontal_top: "*",
horizontal_bottom: "*",
});
let label_block = Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED)
.border_set(ratatui::symbols::border::Set {
top_left: " ",
top_right: " ",
bottom_left: " ",
bottom_right: " ",
vertical_left: " ",
vertical_right: " ",
horizontal_top: "*",
horizontal_bottom: "*",
});
let str1 = "Linutil ";
let str2 = "by Chris Titus";
let label = Paragraph::new(Line::from(vec![
Expand All @@ -253,7 +253,8 @@ impl AppState {

let keybinds_block = Block::default()
.title(format!(" {} ", keybind_scope))
.borders(Borders::all());
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED);

let keybinds = create_shortcut_list(shortcuts, keybind_render_width);
let n_lines = keybinds.len() as u16;
Expand Down Expand Up @@ -297,7 +298,11 @@ impl AppState {
};

let list = List::new(tabs)
.block(Block::default().borders(Borders::ALL))
.block(
Block::default()
.borders(Borders::ALL)
.border_set(ratatui::symbols::border::ROUNDED),
)
.highlight_style(tab_hl_style)
.highlight_symbol(self.theme.tab_icon());
frame.render_stateful_widget(list, left_chunks[1], &mut self.current_tab);
Expand Down Expand Up @@ -409,6 +414,7 @@ impl AppState {
.block(
Block::default()
.borders(Borders::ALL & !Borders::RIGHT)
.border_set(ratatui::symbols::border::ROUNDED)
.title(title)
.title_bottom(bottom_title),
)
Expand All @@ -418,6 +424,7 @@ impl AppState {
let disclaimer_list = List::new(task_items).highlight_style(style).block(
Block::default()
.borders(Borders::ALL & !Borders::LEFT)
.border_set(ratatui::symbols::border::ROUNDED)
.title(task_list_title),
);

Expand Down

0 comments on commit c36879e

Please sign in to comment.