1use crate::prelude::*;
2use crate::{OrderMethod, Palette, PaletteItem};
3
4#[derive(Element)]
5pub struct RecentProjects {
6 scroll_state: ScrollState,
7}
8
9impl RecentProjects {
10 pub fn new() -> Self {
11 Self {
12 scroll_state: ScrollState::default(),
13 }
14 }
15
16 fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
17 div().child(
18 Palette::new(self.scroll_state.clone())
19 .items(vec![
20 PaletteItem::new("zed").sublabel("~/projects/zed"),
21 PaletteItem::new("saga").sublabel("~/projects/saga"),
22 PaletteItem::new("journal").sublabel("~/journal"),
23 PaletteItem::new("dotfiles").sublabel("~/dotfiles"),
24 PaletteItem::new("zed.dev").sublabel("~/projects/zed.dev"),
25 PaletteItem::new("laminar").sublabel("~/projects/laminar"),
26 ])
27 .placeholder("Recent Projects...")
28 .empty_string("No matches")
29 .default_order(OrderMethod::Ascending),
30 )
31 }
32}