From bb3eb5e3c037fb6775a136c2f363b96ff786d6ab Mon Sep 17 00:00:00 2001 From: Dongdong Zhou Date: Tue, 21 Feb 2023 21:18:35 +0000 Subject: [PATCH] settings style --- lapce-app/src/title.rs | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/lapce-app/src/title.rs b/lapce-app/src/title.rs index a73d61a9..667e3157 100644 --- a/lapce-app/src/title.rs +++ b/lapce-app/src/title.rs @@ -173,6 +173,7 @@ fn middle(cx: AppContext, config: ReadSignal>) -> impl View { justify_content: Some(JustifyContent::Center), align_items: Some(AlignItems::Center), border: 1.0, + border_radius: 2.0, background: Some( *config.get().get_color(LapceColor::EDITOR_BACKGROUND), ), @@ -210,14 +211,27 @@ fn middle(cx: AppContext, config: ReadSignal>) -> impl View { }) } -fn right(cx: AppContext) -> impl View { - let (read_svg, set_svg) = create_signal(cx.scope, r#" "#.to_string()); +fn right(cx: AppContext, config: ReadSignal>) -> impl View { container(cx, move |cx| { - svg(cx, move || read_svg.get()).style(cx, || Style { - width: Dimension::Points(20.0), - height: Dimension::Points(20.0), - ..Default::default() - }) + svg(cx, move || config.get().ui_svg(LapceIcons::SETTINGS)).style( + cx, + move || { + let icon_size = config.get().ui.icon_size() as f32; + Style { + width: Dimension::Points(icon_size), + height: Dimension::Points(icon_size), + ..Default::default() + } + }, + ) + }) + .style(cx, || Style { + flex_basis: Dimension::Points(0.0), + flex_grow: 1.0, + padding_left: 10.0, + padding_right: 10.0, + justify_content: Some(JustifyContent::FlexEnd), + ..Default::default() }) } @@ -229,18 +243,11 @@ pub fn title( let connected = proxy_data.connected; let diff_info = proxy_data.diff_info; let head = move || diff_info.get().map(|info| info.head); - let (read_svg, set_svg) = create_signal(cx.scope, r#" "#.to_string()); stack(cx, move |cx| { ( left(cx, proxy_data, config), middle(cx, config), - right(cx).style(cx, || Style { - flex_basis: Dimension::Points(0.0), - flex_grow: 1.0, - justify_content: Some(JustifyContent::FlexEnd), - border: 1.0, - ..Default::default() - }), + right(cx, config), ) }) .style(cx, move || Style {