icon_theme_selector: Add footer and related docs (#25042)

I've seen that the Theme modal has a footer with 2 links: Theme Docs
(which links to Configuration > Themes) on the left, Install Themes on
the right. I've basically done the same to the Icon Theme modal -
however we seem to be missing a Configuration > Icon Themes doc, I've
basically checked how it was made for Themes and pretty much adapted for
Icon Themes. Maybe a better solution would be to combine both. Or add
Icon themes section under Themes.

I hope somebody from Zed can have a look and adapt this PR where needed.

<img width="553" alt="Screenshot 2025-02-19 at 6 37 20 PM"
src="https://github.com/user-attachments/assets/30602027-b7a7-4690-ba05-fc9eac313e67"
/>

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
Beniamin Zagan 2025-02-20 01:02:24 +01:00 committed by GitHub
parent b8ed6e8f4d
commit 121aba7106
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 69 additions and 0 deletions

View file

@ -11,6 +11,7 @@ use theme::{Appearance, IconTheme, ThemeMeta, ThemeRegistry, ThemeSettings};
use ui::{prelude::*, v_flex, ListItem, ListItemSpacing};
use util::ResultExt;
use workspace::{ui::HighlightedLabel, ModalView};
use zed_actions::Extensions;
pub(crate) struct IconThemeSelector {
picker: Entity<Picker<IconThemeSelectorDelegate>>,
@ -273,4 +274,38 @@ impl PickerDelegate for IconThemeSelectorDelegate {
)),
)
}
fn render_footer(
&self,
_window: &mut Window,
cx: &mut Context<Picker<Self>>,
) -> Option<gpui::AnyElement> {
Some(
h_flex()
.p_2()
.w_full()
.justify_between()
.gap_2()
.border_t_1()
.border_color(cx.theme().colors().border_variant)
.child(
Button::new("docs", "View Icon Theme Docs")
.icon(IconName::ArrowUpRight)
.icon_position(IconPosition::End)
.icon_size(IconSize::XSmall)
.icon_color(Color::Muted)
.on_click(|_event, _window, cx| {
cx.open_url("https://zed.dev/docs/icon-themes");
}),
)
.child(
Button::new("more-icon-themes", "Install Icon Themes").on_click(
move |_event, window, cx| {
window.dispatch_action(Box::new(Extensions), cx);
},
),
)
.into_any_element(),
)
}
}