subspace_dashboard/
toggle.rs1pub mod track;
4
5use gpui_kit::component::{ActiveTheme as _, h_flex, switch::Switch};
6use gpui_kit::{App, Div, ElementId, SharedString, Styled, div, prelude::*};
7
8pub fn switch(id: impl Into<ElementId>, cx: &App) -> Switch {
12 Switch::new(id).color(track::switch_colors(cx.theme()).on)
13}
14
15pub fn toggle_row(label: impl Into<SharedString>, switch: Switch) -> Div {
20 let label = label.into();
21 h_flex()
22 .w_full()
23 .items_start()
24 .gap_3()
25 .child(div().flex_1().min_w_0().child(label.clone()))
26 .child(
27 div()
28 .flex_shrink_0()
29 .child(switch.accessibility_label(label)),
30 )
31}
32
33#[cfg(test)]
34mod tests;