status_badge

Status icon-plus-label molecule used in task rows and detail views.

struct Component

source

pub struct Component<'a>

Renders a status icon + label for a given status string.

Field Type Description
show_text bool Whether to show the label after the icon; only tests turn it off.
status &'a str Status string: open, in-progress, done, cancelled or blocked.

Implements Display.

Component::new

source

pub fn new(status: &'a str) -> Self

Create a status badge for the given status string (e.g. "open", "in-progress").

Parameter Type Description
status &'a str the status; an unknown one is shown with the open icon and style
returns Self The badge, showing the icon and the label.

Component::icon

source

fn icon(&self) -> Icon

Pick the icon: ⊗ for blocked, otherwise the Icon::status glyph.

Parameter Type Description
returns Icon The icon for the status.

Component::label

source

fn label(&self) -> &str

Pick the label text, which spells in-progress as in progress.

Parameter Type Description
returns &str The label, borrowed from the status or a static string.

Component::style

source

fn style(&self) -> Style

Pick the label style from the theme’s status tokens.

Parameter Type Description
returns Style The status.* style for the status; indicator.blocked for blocked; status.open for anything else.