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
|
@ -233,20 +233,19 @@ pub use stories::*;
|
|||
|
||||
#[cfg(feature = "stories")]
|
||||
mod stories {
|
||||
use gpui2::rems;
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
empty_buffer_example, hello_world_rust_buffer_example,
|
||||
hello_world_rust_buffer_with_status_example, Story,
|
||||
};
|
||||
use gpui2::{rems, Div, Render};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct BufferStory;
|
||||
|
||||
impl BufferStory {
|
||||
fn render<V: 'static>(self, _view: &mut V, cx: &mut ViewContext<V>) -> impl Component<V> {
|
||||
impl Render for BufferStory {
|
||||
type Element = Div<Self>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
let theme = theme(cx);
|
||||
|
||||
Story::container(cx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue