Pass a closure to provide styling to Select

This lets us obtain a new style when refreshing the theme.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-08-31 14:42:50 +02:00
co-authored by Nathan Sobo
parent 73a8fda9c7
commit 8edb2142b1
2 changed files with 23 additions and 10 deletions
+9 -4
View File
@@ -46,7 +46,6 @@ impl ChatPanel {
let input_editor = cx.add_view(|cx| Editor::auto_height(settings.clone(), cx));
let channel_select = cx.add_view(|cx| {
let channel_list = channel_list.clone();
let theme = &settings.borrow().theme.chat_panel.channel_select;
Select::new(0, cx, {
let settings = settings.clone();
move |ix, item_type, is_hovered, cx| {
@@ -60,9 +59,15 @@ impl ChatPanel {
)
}
})
.with_style(&SelectStyle {
header: theme.header.container.clone(),
menu: theme.menu.clone(),
.with_style({
let settings = settings.clone();
move |_| {
let theme = &settings.borrow().theme.chat_panel.channel_select;
SelectStyle {
header: theme.header.container.clone(),
menu: theme.menu.clone(),
}
}
})
});
let mut this = Self {