diff options
Diffstat (limited to 'schist_desktop_gui/src/gui/components/bucket_navigation_entry')
| -rw-r--r-- | schist_desktop_gui/src/gui/components/bucket_navigation_entry/bucket_group_name.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/schist_desktop_gui/src/gui/components/bucket_navigation_entry/bucket_group_name.rs b/schist_desktop_gui/src/gui/components/bucket_navigation_entry/bucket_group_name.rs new file mode 100644 index 0000000..cbc9521 --- /dev/null +++ b/schist_desktop_gui/src/gui/components/bucket_navigation_entry/bucket_group_name.rs @@ -0,0 +1,36 @@ +use iced::{ + widget::{row, text}, + Element, Length, +}; + +use crate::gui::components::{navigation, BucketNavigationEntry}; + +#[derive(Clone, Debug, PartialEq)] +pub struct BucketGroupName { + pub group: String, + pub is_open: bool, +} + +impl BucketGroupName { + pub fn new(group: &str, is_open: bool) -> Self { + Self { + group: group.to_string(), + is_open, + } + } +} + +impl<'a> From<&'a BucketGroupName> for Element<'a, navigation::Message<BucketNavigationEntry>> { + 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() + } +} |
