assistant2: Add design refinements (#27160)

Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Agus Zubiaga <hi@aguz.me>
This commit is contained in:
Danilo Leal 2025-03-21 03:19:41 -03:00 committed by GitHub
parent 962709f42c
commit 8f86cd758a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 522 additions and 249 deletions

View file

@ -11,6 +11,8 @@ pub struct Disclosure {
selected: bool,
on_toggle: Option<Arc<dyn Fn(&ClickEvent, &mut Window, &mut App) + 'static>>,
cursor_style: CursorStyle,
opened_icon: IconName,
closed_icon: IconName,
}
impl Disclosure {
@ -21,6 +23,8 @@ impl Disclosure {
selected: false,
on_toggle: None,
cursor_style: CursorStyle::PointingHand,
opened_icon: IconName::ChevronDown,
closed_icon: IconName::ChevronRight,
}
}
@ -31,6 +35,16 @@ impl Disclosure {
self.on_toggle = handler.into();
self
}
pub fn opened_icon(mut self, icon: IconName) -> Self {
self.opened_icon = icon;
self
}
pub fn closed_icon(mut self, icon: IconName) -> Self {
self.closed_icon = icon;
self
}
}
impl Toggleable for Disclosure {
@ -57,8 +71,8 @@ impl RenderOnce for Disclosure {
IconButton::new(
self.id,
match self.is_open {
true => IconName::ChevronDown,
false => IconName::ChevronRight,
true => self.opened_icon,
false => self.closed_icon,
},
)
.shape(IconButtonShape::Square)

View file

@ -143,6 +143,7 @@ pub enum IconName {
ArrowUp,
ArrowUpFromLine,
ArrowUpRight,
ArrowUpRightAlt,
AtSign,
AudioOff,
AudioOn,
@ -156,6 +157,7 @@ pub enum IconName {
Book,
BookCopy,
BookPlus,
Brain,
CaseSensitive,
Check,
ChevronDown,