Line toggles replace switches
Browse files at this commitce88fa74677d9ec74a66a917bea8d8b6c67c5b64Parent: 0b53b2e- feat
- line toggles replace switches
- sliders in paper
4 changed files +22 -19
- crates/client/src/gui.rs +2 -0
- crates/client/src/gui/builder.rs +2 -4
- crates/client/src/gui/settings_page.rs +10 -8
- crates/client/src/gui/share_view.rs +8 -7
crates/client/src/gui.rsmodified+2 -0
| @@ -190,6 +190,8 @@ pub fn sync_theme(cx: &mut App) { | |||
| 190 | colors.ring = palette.accent; | 190 | colors.ring = palette.accent; |
| 191 | colors.caret = palette.accent; | 191 | colors.caret = palette.accent; |
| 192 | colors.danger = palette.danger; | 192 | colors.danger = palette.danger; |
| 193 | + colors.slider_bar = palette.text; | ||
| 194 | + colors.slider_thumb = palette.text; | ||
| 193 | theme.tokens = (&theme.colors).into(); | 195 | theme.tokens = (&theme.colors).into(); |
| 194 | theme.radius = px(radius::SM); | 196 | theme.radius = px(radius::SM); |
| 195 | theme.radius_lg = px(radius::LG); | 197 | theme.radius_lg = px(radius::LG); |
crates/client/src/gui/builder.rsmodified+2 -4
| @@ -23,7 +23,7 @@ use gpui_kit::{ | |||
| 23 | AnyElement, App, Context, Div, Entity, InteractiveElement, IntoElement, ParentElement, | 23 | AnyElement, App, Context, Div, Entity, InteractiveElement, IntoElement, ParentElement, |
| 24 | StatefulInteractiveElement, Styled, Window, | 24 | StatefulInteractiveElement, Styled, Window, |
| 25 | assets::IconName, | 25 | assets::IconName, |
| 26 | - component::{Icon, input::InputState, switch::Switch}, | 26 | + component::{Icon, input::InputState}, |
| 27 | div, | 27 | div, |
| 28 | prelude::FluentBuilder as _, | 28 | prelude::FluentBuilder as _, |
| 29 | px, | 29 | px, |
| @@ -293,9 +293,7 @@ impl Yumush { | |||
| 293 | .text_color(palette.muted) | 293 | .text_color(palette.muted) |
| 294 | .child("Ghost") | 294 | .child("Ghost") |
| 295 | .child( | 295 | .child( |
| 296 | - Switch::new("ghost_switch") | 296 | + super::parts::toggle("ghost_switch", enabled, palette.tokens, toggle), |
| 297 | - .checked(enabled) | ||
| 298 | - .on_change(move |_, window, cx| toggle(window, cx)), | ||
| 299 | ) | 297 | ) |
| 300 | } | 298 | } |
| 301 | 299 | ||
crates/client/src/gui/settings_page.rsmodified+10 -8
| @@ -10,7 +10,7 @@ use gpui_kit::{ | |||
| 10 | InteractiveElement, IntoElement, ParentElement, PathPromptOptions, Stateful, | 10 | InteractiveElement, IntoElement, ParentElement, PathPromptOptions, Stateful, |
| 11 | StatefulInteractiveElement, Styled, WeakEntity, Window, | 11 | StatefulInteractiveElement, Styled, WeakEntity, Window, |
| 12 | assets::IconName, | 12 | assets::IconName, |
| 13 | - component::{input::InputState, switch::Switch}, | 13 | + component::input::InputState, |
| 14 | div, | 14 | div, |
| 15 | prelude::FluentBuilder as _, | 15 | prelude::FluentBuilder as _, |
| 16 | px, transparent_black, | 16 | px, transparent_black, |
| @@ -117,18 +117,20 @@ impl Yumush { | |||
| 117 | ), | 117 | ), |
| 118 | row( | 118 | row( |
| 119 | "Close to tray", | 119 | "Close to tray", |
| 120 | - Switch::new("close_to_tray_switch") | 120 | + super::parts::toggle( |
| 121 | - .checked(self.settings.close_to_tray) | 121 | + "close_to_tray_switch", |
| 122 | - .on_change({ | 122 | + self.settings.close_to_tray, |
| 123 | + palette.tokens, | ||
| 124 | + { | ||
| 123 | let entity = entity.clone(); | 125 | let entity = entity.clone(); |
| 124 | - move |checked, _, cx| { | 126 | + move |_, cx| { |
| 125 | - let checked = *checked; | ||
| 126 | entity.update(cx, |yumush, cx| { | 127 | entity.update(cx, |yumush, cx| { |
| 127 | - yumush.settings.close_to_tray = checked; | 128 | + yumush.settings.close_to_tray = !yumush.settings.close_to_tray; |
| 128 | yumush.commit_settings(cx); | 129 | yumush.commit_settings(cx); |
| 129 | }) | 130 | }) |
| 130 | } | 131 | } |
| 131 | - }), | 132 | + }, |
| 133 | + ), | ||
| 132 | ), | 134 | ), |
| 133 | ], | 135 | ], |
| 134 | ) | 136 | ) |
crates/client/src/gui/share_view.rsmodified+8 -7
| @@ -23,7 +23,6 @@ use gpui_kit::{ | |||
| 23 | Icon, | 23 | Icon, |
| 24 | popover::Popover, | 24 | popover::Popover, |
| 25 | slider::{Slider, SliderEvent, SliderState}, | 25 | slider::{Slider, SliderEvent, SliderState}, |
| 26 | - switch::Switch, | ||
| 27 | }, | 26 | }, |
| 28 | div, | 27 | div, |
| 29 | prelude::FluentBuilder as _, | 28 | prelude::FluentBuilder as _, |
| @@ -950,14 +949,16 @@ fn include_row( | |||
| 950 | 949 | ||
| 951 | row_style(div()).child(name_cell(app, palette)).child( | 950 | row_style(div()).child(name_cell(app, palette)).child( |
| 952 | div().flex_shrink_0().child( | 951 | div().flex_shrink_0().child( |
| 953 | - Switch::new(format!("share_app_{}", app.key())) | 952 | + super::parts::toggle( |
| 954 | - .checked(included) | 953 | + gpui_kit::ElementId::Name(format!("share_app_{}", app.key()).into()), |
| 955 | - .on_change(move |checked, _, cx| { | 954 | + included, |
| 956 | - let included = *checked; | 955 | + palette.tokens, |
| 956 | + move |_, cx| { | ||
| 957 | entity.update(cx, |yumush, cx| { | 957 | entity.update(cx, |yumush, cx| { |
| 958 | - yumush.set_share_included(&target, included, cx) | 958 | + yumush.set_share_included(&target, !included, cx) |
| 959 | }); | 959 | }); |
| 960 | - }), | 960 | + }, |
| 961 | + ), | ||
| 961 | ), | 962 | ), |
| 962 | ) | 963 | ) |
| 963 | } | 964 | } |