use std::marker::PhantomData; use crate::prelude::*; use crate::{example_editor_actions, OrderMethod, Palette}; #[derive(Element)] pub struct CommandPalette { view_type: PhantomData, scroll_state: ScrollState, } impl CommandPalette { pub fn new(scroll_state: ScrollState) -> Self { Self { view_type: PhantomData, scroll_state, } } fn render(&mut self, _: &mut V, cx: &mut ViewContext) -> impl IntoElement { div().child( Palette::new(self.scroll_state.clone()) .items(example_editor_actions()) .placeholder("Execute a command...") .empty_string("No items found.") .default_order(OrderMethod::Ascending), ) } }