forge
Explore
Log in

Don't you dare go Hollow

Checkboxes become the line toggle (forward keep authors, poll options)

Browse files at this commit

3c05dfa13a14cf8e234e047b28dde9b4991507fbAhmet Kaan GümüşParent: 764cf77
  • style
    • checkboxes become the line toggle (forward keep authors, poll options)
    • selects sit on the underline frame (voice devices, builder log action)
Show full message
💄 style: checkboxes become the line toggle (forward keep authors, poll options); selects sit on the underline frame (voice devices, builder log action)
crates/client/src/gui/builder/log.rsmodified+7 -1
@@ -277,7 +277,13 @@ impl Yumush {
277277 let filters = toolbar(vec![
278278 fixed(size::THUMB, field(palette, &self.chat.builder_log_actor)),
279279 fixed(size::THUMB, field(palette, &self.chat.builder_log_target)),
280- fixed(size::THUMB, Select::new(&self.chat.builder_log_action)),
280+ fixed(
281+ size::THUMB,
282+ crate::gui::widget::underline(
283+ palette,
284+ Select::new(&self.chat.builder_log_action).appearance(false),
285+ ),
286+ ),
281287 fixed(size::THUMB, field(palette, &self.chat.builder_log_from)),
282288 fixed(size::THUMB, field(palette, &self.chat.builder_log_to)),
283289 accent_button(
crates/client/src/gui/composer.rsmodified+16 -11
@@ -21,7 +21,6 @@ use gpui_kit::{
2121 assets::IconName,
2222 component::{
2323 Icon, WindowExt,
24- checkbox::Checkbox,
2524 input::{InputEvent, InputState, TextareaState},
2625 notification::Notification,
2726 popover::Popover,
@@ -756,24 +755,30 @@ pub fn plus_popover(chat: &Chat, entity: &Entity<Yumush>, palette: Palette) -> i
756755 .items_center()
757756 .gap(px(space::MD))
758757 .child(
759- Checkbox::new("poll_multiple")
760- .label(w().composer.multiple_answers)
761- .checked(multiple)
762- .on_click(move |_, _, cx| {
758+ super::parts::labeled_toggle(
759+ "poll_multiple",
760+ w().composer.multiple_answers,
761+ multiple,
762+ palette.tokens,
763+ move |_, cx| {
763764 toggle.update(cx, |yumush, cx| {
764765 yumush.chat.poll_multiple = !yumush.chat.poll_multiple;
765766 cx.notify();
766767 })
767- }),
768+ },
769+ ),
768770 )
769771 .child(
770- Checkbox::new("poll_public")
771- .label(w().composer.show_voters)
772- .checked(public)
773- .on_click(move |_, _, cx| {
772+ super::parts::labeled_toggle(
773+ "poll_public",
774+ w().composer.show_voters,
775+ public,
776+ palette.tokens,
777+ move |_, cx| {
774778 toggle_public
775779 .update(cx, |yumush, cx| yumush.toggle_poll_public(cx))
776- }),
780+ },
781+ ),
777782 ),
778783 ),
779784 )
crates/client/src/gui/forward.rsmodified+8 -6
@@ -7,7 +7,6 @@ use gpui_kit::{
77 StatefulInteractiveElement, Styled, Window,
88 component::{
99 WindowExt,
10- checkbox::Checkbox,
1110 input::{InputEvent, InputState},
1211 },
1312 div, px,
@@ -110,15 +109,18 @@ impl Render for Forward {
110109 .gap(px(space::MD))
111110 .child(compact_field(palette, &self.filter))
112111 .child(
113- Checkbox::new("keep_authors")
114- .label(w().forward.keep_authors)
115- .checked(keep_authors)
116- .on_click(move |_, _, cx| {
112+ super::parts::labeled_toggle(
113+ "keep_authors",
114+ w().forward.keep_authors,
115+ keep_authors,
116+ palette.tokens,
117+ move |_, cx| {
117118 entity.update(cx, |this, cx| {
118119 this.keep_authors = !this.keep_authors;
119120 cx.notify();
120121 });
121- }),
122+ },
123+ ),
122124 )
123125 .child(
124126 div()
crates/client/src/gui/parts.rsmodified+15 -0
@@ -148,6 +148,21 @@ pub fn track(fill: Fill, bad: bool, t: Tokens) -> Div {
148148 }
149149 }
150150
151+pub fn labeled_toggle(
152+ id: impl Into<ElementId>,
153+ label: &'static str,
154+ on: bool,
155+ t: Tokens,
156+ flip: impl Fn(&mut Window, &mut App) + 'static,
157+) -> Div {
158+ div()
159+ .flex()
160+ .items_center()
161+ .gap(px(space::SM))
162+ .child(words(label, Text::Caption, Ink::Dim, t))
163+ .child(toggle(id, on, t, flip))
164+}
165+
151166 pub fn toggle(
152167 id: impl Into<ElementId>,
153168 on: bool,
crates/client/src/gui/voice_settings.rsmodified+10 -10
@@ -239,19 +239,19 @@ impl Yumush {
239239 let mut rows = vec![
240240 row(
241241 w().voice_settings.input_device,
242- div().child(
243- Select::new(&controls.inputs)
244- .appearance(false)
245- .w(px(size::SIDEBAR)),
246- ),
242+ super::widget::underline(
243+ palette,
244+ Select::new(&controls.inputs).appearance(false),
245+ )
246+ .w(px(size::SIDEBAR)),
247247 ),
248248 row(
249249 w().voice_settings.output_device,
250- div().child(
251- Select::new(&controls.outputs)
252- .appearance(false)
253- .w(px(size::SIDEBAR)),
254- ),
250+ super::widget::underline(
251+ palette,
252+ Select::new(&controls.outputs).appearance(false),
253+ )
254+ .w(px(size::SIDEBAR)),
255255 ),
256256 row(
257257 w().voice_settings.input_volume,
crates/client/src/gui/widget.rsmodified+10 -0
@@ -66,6 +66,16 @@ pub(super) fn frame(palette: Palette, input: Input) -> Div {
6666 .child(bare_input(palette, input))
6767 }
6868
69+pub(super) fn underline(palette: Palette, child: impl gpui_kit::IntoElement) -> Div {
70+ div()
71+ .h(px(size::CONTROL))
72+ .flex()
73+ .items_center()
74+ .border_b_1()
75+ .border_color(palette.border)
76+ .child(div().flex_1().min_w_0().child(child))
77+}
78+
6979 pub(super) fn bare_input(palette: Palette, input: Input) -> Input {
7080 input
7181 .appearance(false)