refactor: use indoc!
for better formatting of cat ascii art
This commit is contained in:
parent
fc41a499e6
commit
764cddee0e
1 changed files with 13 additions and 6 deletions
|
@ -1,10 +1,18 @@
|
||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
|
use indoc::indoc;
|
||||||
use ratatui::{prelude::*, widgets::*};
|
use ratatui::{prelude::*, widgets::*};
|
||||||
use tokio::sync::mpsc::UnboundedSender;
|
use tokio::sync::mpsc::UnboundedSender;
|
||||||
|
|
||||||
use super::Component;
|
use super::Component;
|
||||||
use crate::{action::Action, config::Config};
|
use crate::{action::Action, config::Config};
|
||||||
|
|
||||||
|
const CAT_ASCII_ART: &str = indoc! {r#"
|
||||||
|
|\__/,| (`\
|
||||||
|
|_ _ |.--.) )
|
||||||
|
( T ) /
|
||||||
|
(((^_(((/(((_>
|
||||||
|
"#};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Cat {
|
pub struct Cat {
|
||||||
command_tx: Option<UnboundedSender<Action>>,
|
command_tx: Option<UnboundedSender<Action>>,
|
||||||
|
@ -38,13 +46,12 @@ impl Component for Cat {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
|
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
|
||||||
const CART: &str = r#" |\__/,| (`\
|
|
||||||
|_ _ |.--.) )
|
|
||||||
( T ) /
|
|
||||||
(((^_(((/(((_>"#;
|
|
||||||
|
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
Paragraph::new(CART).style(Style::default().fg(Color::Magenta).add_modifier(Modifier::SLOW_BLINK | Modifier::BOLD)),
|
Paragraph::new(CAT_ASCII_ART).style(
|
||||||
|
Style::default()
|
||||||
|
.fg(Color::Magenta)
|
||||||
|
.add_modifier(Modifier::SLOW_BLINK | Modifier::BOLD),
|
||||||
|
),
|
||||||
Rect {
|
Rect {
|
||||||
x: area.width - 17,
|
x: area.width - 17,
|
||||||
y: area.height - 4,
|
y: area.height - 4,
|
||||||
|
|
Loading…
Add table
Reference in a new issue