Reorganize element-related traits

This commit is contained in:
Nathan Sobo 2023-11-22 11:19:43 -07:00
parent ca1d9dd0e5
commit c23f17ee0b
42 changed files with 190 additions and 265 deletions

View file

@ -1,7 +1,7 @@
use crate::prelude::*;
use gpui::{Action, Div, RenderOnce};
use gpui::{Action, Div, IntoElement};
#[derive(RenderOnce, Clone)]
#[derive(IntoElement, Clone)]
pub struct KeyBinding {
/// A keybinding consists of a key and a set of modifier keys.
/// More then one keybinding produces a chord.
@ -10,7 +10,7 @@ pub struct KeyBinding {
key_binding: gpui::KeyBinding,
}
impl Component for KeyBinding {
impl RenderOnce for KeyBinding {
type Rendered = Div;
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
@ -44,12 +44,12 @@ impl KeyBinding {
}
}
#[derive(RenderOnce)]
#[derive(IntoElement)]
pub struct Key {
key: SharedString,
}
impl Component for Key {
impl RenderOnce for Key {
type Rendered = Div;
fn render(self, cx: &mut WindowContext) -> Self::Rendered {