Introduce a Render trait, make views implement it
Don't pass a render function separately from the view. Co-authored-by: Nathan Sobo <nathan@zed.dev> Co-authored-by: Mikayla <mikayla@zed.dev> Co-authored-by: Antonio <as-cii@zed.dev>
This commit is contained in:
parent
0128079de0
commit
30dffbb409
49 changed files with 616 additions and 612 deletions
|
@ -57,15 +57,16 @@ pub use stories::*;
|
|||
|
||||
#[cfg(feature = "stories")]
|
||||
mod stories {
|
||||
use crate::{Panel, Story};
|
||||
|
||||
use super::*;
|
||||
use crate::{Panel, Story};
|
||||
use gpui2::{Div, Render};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct ProjectPanelStory;
|
||||
|
||||
impl ProjectPanelStory {
|
||||
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
impl Render for ProjectPanelStory {
|
||||
type Element = Div<Self>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, ProjectPanel>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue