Update boolean in settings ui to show up as switch fields
Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
parent
1fd0f7a46b
commit
8ff656c999
1 changed files with 18 additions and 5 deletions
|
@ -6,8 +6,8 @@ use command_palette_hooks::CommandPaletteFilter;
|
||||||
use editor::EditorSettingsControls;
|
use editor::EditorSettingsControls;
|
||||||
use feature_flags::{FeatureFlag, FeatureFlagViewExt};
|
use feature_flags::{FeatureFlag, FeatureFlagViewExt};
|
||||||
use gpui::{App, Entity, EventEmitter, FocusHandle, Focusable, ReadGlobal, actions};
|
use gpui::{App, Entity, EventEmitter, FocusHandle, Focusable, ReadGlobal, actions};
|
||||||
use settings::SettingsStore;
|
use settings::{SettingsStore, SettingsUIItemSingle, SettingsUIItemVariant};
|
||||||
use ui::prelude::*;
|
use ui::{SwitchField, prelude::*};
|
||||||
use workspace::item::{Item, ItemEvent};
|
use workspace::item::{Item, ItemEvent};
|
||||||
use workspace::{Workspace, with_active_or_new_workspace};
|
use workspace::{Workspace, with_active_or_new_workspace};
|
||||||
|
|
||||||
|
@ -139,9 +139,22 @@ impl Render for SettingsPage {
|
||||||
.child(format!("Subgroup: {}", title))
|
.child(format!("Subgroup: {}", title))
|
||||||
.into_any_element(),
|
.into_any_element(),
|
||||||
settings::SettingsUIItemVariant::Item { path, item } => {
|
settings::SettingsUIItemVariant::Item { path, item } => {
|
||||||
div()
|
match item {
|
||||||
.child(format!("Item: {}", path))
|
SettingsUIItemSingle::Custom(_) => div()
|
||||||
.into_any_element()
|
.child(format!("Item: {}", path))
|
||||||
|
.into_any_element(),
|
||||||
|
SettingsUIItemSingle::SwitchField => div()
|
||||||
|
.child(SwitchField::new(
|
||||||
|
ElementId::Name(SharedString::new_static(
|
||||||
|
path,
|
||||||
|
)),
|
||||||
|
SharedString::new_static(path),
|
||||||
|
None,
|
||||||
|
ToggleState::Unselected,
|
||||||
|
|_, _, _| {},
|
||||||
|
))
|
||||||
|
.into_any_element(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
settings::SettingsUIItemVariant::None => {
|
settings::SettingsUIItemVariant::None => {
|
||||||
div().child("None").into_any_element()
|
div().child("None").into_any_element()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue