Render editor fold indicators using Disclosures (#13008)

This PR updates the spots where we render the fold indicators in editors
to use the `Disclosure` component instead of re-implementing similar UI.

This makes this UI more consistent across Zed.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-06-13 16:05:47 -04:00 committed by GitHub
parent af8e7af265
commit 1a40e98413
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 32 deletions

View file

@ -54,8 +54,8 @@ use std::{
};
use telemetry_events::AssistantKind;
use ui::{
popover_menu, prelude::*, ButtonLike, ContextMenu, ElevationIndex, KeyBinding, ListItem,
ListItemSpacing, PopoverMenuHandle, Tab, TabBar, Tooltip,
popover_menu, prelude::*, ButtonLike, ContextMenu, Disclosure, ElevationIndex, KeyBinding,
ListItem, ListItemSpacing, PopoverMenuHandle, Tab, TabBar, Tooltip,
};
use util::{paths::CONTEXTS_DIR, post_inc, ResultExt, TryFutureExt};
use uuid::Uuid;
@ -3132,17 +3132,10 @@ fn render_slash_command_output_toggle(
fold: ToggleFold,
_cx: &mut WindowContext,
) -> AnyElement {
IconButton::new(
("slash-command-output-fold-indicator", row.0),
ui::IconName::ChevronDown,
)
.on_click(move |_e, cx| fold(!is_folded, cx))
.icon_color(ui::Color::Muted)
.icon_size(ui::IconSize::Small)
.selected(is_folded)
.selected_icon(ui::IconName::ChevronRight)
.size(ui::ButtonSize::None)
.into_any_element()
Disclosure::new(("slash-command-output-fold-indicator", row.0), !is_folded)
.selected(is_folded)
.on_click(move |_e, cx| fold(!is_folded, cx))
.into_any_element()
}
fn render_pending_slash_command_gutter_decoration(