use iced::{ widget::{row, text}, Element, Length, }; use crate::{ gui::components::{navigation, BucketNavigationEntry}, impl_focusable, }; #[derive(Clone, Debug, PartialEq)] pub struct BucketGroupName { pub group: String, pub is_open: bool, pub is_focused: bool, } impl BucketGroupName { pub fn new(group: &str, is_open: bool) -> Self { Self { group: group.to_string(), is_open, is_focused: false, } } } impl<'a> From<&'a BucketGroupName> for Element<'a, navigation::Message> { fn from(bucket_group_name: &'a BucketGroupName) -> Self { let text_content = format!( "{} {}", if bucket_group_name.is_open { "v " } else { "> " }, bucket_group_name.group ); row![text(text_content).width(Length::Fill),].into() } } impl_focusable!(BucketGroupName);