Set sidebar icon heights via theme

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo
2021-09-07 12:45:48 -06:00
co-authored by Max Brunsfeld
parent e2b30ad031
commit b29e673c43
3 changed files with 13 additions and 7 deletions
+7 -2
View File
@@ -1,3 +1,6 @@
[text]
base = { family = "Inconsolata", size = 14 }
[workspace]
background = "$surface.0"
@@ -19,10 +22,12 @@ padding = { left = 10, right = 10 }
[workspace.sidebar.resize_handle]
margin = { left = 6 }
[workspace.sidebar_icon]
[workspace.sidebar.icon]
color = "$text.2.color"
height = 18
[workspace.active_sidebar_icon]
[workspace.sidebar.active_icon]
extends = "$workspace.sidebar.icon"
color = "$text.0.color"
[chat_panel]
+3 -2
View File
@@ -36,8 +36,6 @@ pub struct Workspace {
pub tab: Tab,
pub active_tab: Tab,
pub sidebar: Sidebar,
pub sidebar_icon: SidebarIcon,
pub active_sidebar_icon: SidebarIcon,
}
#[derive(Deserialize)]
@@ -54,12 +52,15 @@ pub struct Tab {
#[derive(Deserialize)]
pub struct Sidebar {
pub icons: ContainerStyle,
pub icon: SidebarIcon,
pub active_icon: SidebarIcon,
pub resize_handle: ContainerStyle,
}
#[derive(Deserialize)]
pub struct SidebarIcon {
pub color: Color,
pub height: f32,
}
#[derive(Deserialize)]
+3 -3
View File
@@ -71,9 +71,9 @@ impl Sidebar {
Flex::column()
.with_children(self.items.iter().enumerate().map(|(item_index, item)| {
let theme = if Some(item_index) == self.active_item_ix {
&settings.theme.workspace.active_sidebar_icon
&settings.theme.workspace.sidebar.active_icon
} else {
&settings.theme.workspace.sidebar_icon
&settings.theme.workspace.sidebar.icon
};
enum SidebarButton {}
MouseEventHandler::new::<SidebarButton, _, _, _>(item.view.id(), cx, |_, _| {
@@ -82,7 +82,7 @@ impl Sidebar {
ConstrainedBox::new(
Svg::new(item.icon_path).with_color(theme.color).boxed(),
)
.with_height(line_height)
.with_height(theme.height)
.boxed(),
)
.boxed(),