Checkpoint: Compiling after view type removal
This commit is contained in:
parent
c9c9db903d
commit
88ef74ec8f
44 changed files with 392 additions and 695 deletions
|
@ -1,8 +1,6 @@
|
|||
use std::marker::PhantomData;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use gpui2::Div;
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::{h_stack, HighlightedText};
|
||||
|
||||
|
@ -10,28 +8,26 @@ use crate::{h_stack, HighlightedText};
|
|||
pub struct Symbol(pub Vec<HighlightedText>);
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Breadcrumb<S: 'static + Send + Sync> {
|
||||
state_type: PhantomData<S>,
|
||||
pub struct Breadcrumb {
|
||||
path: PathBuf,
|
||||
symbols: Vec<Symbol>,
|
||||
}
|
||||
|
||||
impl<S: 'static + Send + Sync> Breadcrumb<S> {
|
||||
impl Breadcrumb {
|
||||
pub fn new(path: PathBuf, symbols: Vec<Symbol>) -> Self {
|
||||
Self {
|
||||
state_type: PhantomData,
|
||||
path,
|
||||
symbols,
|
||||
}
|
||||
}
|
||||
|
||||
fn render_separator(&self, cx: &WindowContext) -> Div<S> {
|
||||
fn render_separator<V: 'static>(&self, cx: &WindowContext) -> Div<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
div().child(" › ").text_color(theme.text_muted)
|
||||
}
|
||||
|
||||
fn render(self, view_state: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {
|
||||
fn render<V: 'static>(self, view_state: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
let symbols_len = self.symbols.len();
|
||||
|
@ -87,22 +83,18 @@ mod stories {
|
|||
use super::*;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct BreadcrumbStory<S: 'static + Send + Sync> {
|
||||
state_type: PhantomData<S>,
|
||||
}
|
||||
pub struct BreadcrumbStory;
|
||||
|
||||
impl<S: 'static + Send + Sync> BreadcrumbStory<S> {
|
||||
impl BreadcrumbStory {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
state_type: PhantomData,
|
||||
}
|
||||
Self
|
||||
}
|
||||
|
||||
fn render(self, view_state: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {
|
||||
fn render<V: 'static>(self, view_state: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, Breadcrumb<S>>(cx))
|
||||
.child(Story::title_for::<_, Breadcrumb>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
.child(Breadcrumb::new(
|
||||
PathBuf::from_str("crates/ui/src/components/toolbar.rs").unwrap(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue