#[derive(Clone, Debug)]
pub struct BreadcrumbItem {
pub label: String,
pub icon: Option<char>,
pub clickable: bool,
}
impl BreadcrumbItem {
pub fn new(label: impl Into<String>) -> Self {
Self {
label: label.into(),
icon: None,
clickable: true,
}
}
pub fn icon(mut self, icon: char) -> Self {
self.icon = Some(icon);
self
}
pub fn clickable(mut self, clickable: bool) -> Self {
self.clickable = clickable;
self
}
}
#[derive(Clone, Copy, Debug, PartialEq, Default)]
pub enum SeparatorStyle {
#[default]
Slash,
Arrow,
Chevron,
DoubleArrow,
Dot,
Pipe,
Custom(char),
}
impl SeparatorStyle {
pub(crate) fn char(&self) -> char {
match self {
SeparatorStyle::Slash => '/',
SeparatorStyle::Arrow => '>',
SeparatorStyle::Chevron => '›',
SeparatorStyle::DoubleArrow => '»',
SeparatorStyle::Dot => '•',
SeparatorStyle::Pipe => '|',
SeparatorStyle::Custom(c) => *c,
}
}
}