diff options
| author | Joe Carstairs <me@joeac.net> | 2026-02-01 21:03:01 +0000 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-02-01 21:03:01 +0000 |
| commit | c16f22f14b62c6576cc5a4c42a4f45c92b0241b2 (patch) | |
| tree | 0d65dc504b489b42b455a6bda7aa1652ed6360f6 /schist_desktop_gui/src/gui/components/bucket_navigation_entry | |
| parent | 5166f6dbf06f911c5dcb21563274ca98285aca6c (diff) | |
BucketNavigationEntry may be BucketGroupName
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() + } +} |
