settings_ui: Add pickers for theme and icon themes (#40829)
In the process of adding pickers for the theme and icon themes fields in the settings UI, I felt like there was an improvement opportunity in regards to where some of these components are stored. The `ui_input` crate originally was meant only for the text field-like component, which couldn't be in the regular `ui` crate due to the dependency with `editor`. Given we had also added the number field there—which is similar in also having the same dependency—it made sense to think of this crate more like a home for form-like components rather than for only one component. However, we were also storing some settings UI-specific stuff in that crate, which didn't feel right. So I ended up creating a new directory within the `settings_ui` for components and moved all the pickers and the custom input field there. I think this makes it for a cleaner structure. Release Notes: - settings_ui: Added the ability to search for theme and icon themes in their respective fields.
This commit is contained in:
@@ -17,7 +17,7 @@ use persistence::COMPONENT_PREVIEW_DB;
|
||||
use project::Project;
|
||||
use std::{iter::Iterator, ops::Range, sync::Arc};
|
||||
use ui::{ButtonLike, Divider, HighlightedLabel, ListItem, ListSubHeader, Tooltip, prelude::*};
|
||||
use ui_input::SingleLineInput;
|
||||
use ui_input::InputField;
|
||||
use workspace::{
|
||||
AppState, Item, ItemId, SerializableItem, Workspace, WorkspaceId, delete_unloaded_items,
|
||||
item::ItemEvent,
|
||||
@@ -99,7 +99,7 @@ struct ComponentPreview {
|
||||
component_map: HashMap<ComponentId, ComponentMetadata>,
|
||||
components: Vec<ComponentMetadata>,
|
||||
cursor_index: usize,
|
||||
filter_editor: Entity<SingleLineInput>,
|
||||
filter_editor: Entity<InputField>,
|
||||
filter_text: String,
|
||||
focus_handle: FocusHandle,
|
||||
language_registry: Arc<LanguageRegistry>,
|
||||
@@ -126,8 +126,7 @@ impl ComponentPreview {
|
||||
let sorted_components = component_registry.sorted_components();
|
||||
let selected_index = selected_index.into().unwrap_or(0);
|
||||
let active_page = active_page.unwrap_or(PreviewPage::AllComponents);
|
||||
let filter_editor =
|
||||
cx.new(|cx| SingleLineInput::new(window, cx, "Find components or usages…"));
|
||||
let filter_editor = cx.new(|cx| InputField::new(window, cx, "Find components or usages…"));
|
||||
|
||||
let component_list = ListState::new(
|
||||
sorted_components.len(),
|
||||
|
||||
Reference in New Issue
Block a user