Derive icon paths (#17816)

This PR improves adding and working with icons by using the new
`DerivePathStr` to derive icon paths.

This means paths no longer need to be manually specified, and the
`IconName` and file name will always be consistent between icons.

This PR does not do any work to standardize icons visually, remove
unused icons, or any other such cleanup.

Release Notes:

- N/A
This commit is contained in:
Nate Butler 2024-09-13 21:12:29 -04:00 committed by GitHub
parent ce848375fe
commit e8a2dd92c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 96 additions and 226 deletions

View file

@ -4110,7 +4110,7 @@ impl ContextEditor {
h_flex()
.gap_3()
.child(
Icon::new(IconName::ExclamationTriangle)
Icon::new(IconName::Warning)
.size(IconSize::Small)
.color(Color::Warning),
)
@ -5235,7 +5235,7 @@ fn quote_selection_fold_placeholder(title: String, editor: WeakView<Editor>) ->
ButtonLike::new(fold_id)
.style(ButtonStyle::Filled)
.layer(ElevationIndex::ElevatedSurface)
.child(Icon::new(IconName::TextSelect))
.child(Icon::new(IconName::CursorIBeam))
.child(Label::new(title.clone()).single_line())
.on_click(move |_, cx| {
editor
@ -5339,7 +5339,7 @@ fn render_docs_slash_command_trailer(
div()
.id(("latest-error", row.0))
.child(
Icon::new(IconName::ExclamationTriangle)
Icon::new(IconName::Warning)
.size(IconSize::Small)
.color(Color::Warning),
)

View file

@ -1478,7 +1478,7 @@ impl Render for PromptEditor {
.child(
ModelSelector::new(
self.fs.clone(),
IconButton::new("context", IconName::SlidersAlt)
IconButton::new("context", IconName::SettingsAlt)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
.icon_color(Color::Muted)

View file

@ -193,11 +193,11 @@ impl SlashCommand for DiagnosticsSlashCommand {
.map(|(range, placeholder_type)| SlashCommandOutputSection {
range,
icon: match placeholder_type {
PlaceholderType::Root(_, _) => IconName::ExclamationTriangle,
PlaceholderType::Root(_, _) => IconName::Warning,
PlaceholderType::File(_) => IconName::File,
PlaceholderType::Diagnostic(DiagnosticType::Error, _) => IconName::XCircle,
PlaceholderType::Diagnostic(DiagnosticType::Warning, _) => {
IconName::ExclamationTriangle
IconName::Warning
}
},
label: match placeholder_type {

View file

@ -585,7 +585,7 @@ impl Render for PromptEditor {
.gap_2()
.child(ModelSelector::new(
self.fs.clone(),
IconButton::new("context", IconName::SlidersAlt)
IconButton::new("context", IconName::SettingsAlt)
.shape(IconButtonShape::Square)
.icon_size(IconSize::Small)
.icon_color(Color::Muted)