WIP
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use gpui3::{Element, ParentElement, StyleHelpers, ViewContext};
|
||||
use gpui3::{Element, ParentElement, ViewContext};
|
||||
|
||||
use crate::{
|
||||
h_stack, v_stack, Button, Icon, IconButton, IconElement, Label, ThemeColor, Toast, ToastOrigin,
|
||||
|
||||
@@ -140,9 +140,7 @@ impl<S: 'static + Send + Sync> Panel<S> {
|
||||
}
|
||||
|
||||
impl<S: 'static + Send + Sync> ParentElement for Panel<S> {
|
||||
type State = S;
|
||||
|
||||
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<Self::State>; 2]> {
|
||||
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<Self::ViewState>; 2]> {
|
||||
&mut self.children
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,7 @@ impl<S: 'static + Send + Sync> Pane<S> {
|
||||
}
|
||||
|
||||
impl<S: 'static + Send + Sync> ParentElement for Pane<S> {
|
||||
type State = S;
|
||||
|
||||
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<Self::State>; 2]> {
|
||||
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<Self::ViewState>; 2]> {
|
||||
&mut self.children
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,9 +62,7 @@ impl<S: 'static + Send + Sync> Toast<S> {
|
||||
}
|
||||
|
||||
impl<S: 'static + Send + Sync> ParentElement for Toast<S> {
|
||||
type State = S;
|
||||
|
||||
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<Self::State>; 2]> {
|
||||
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<Self::ViewState>; 2]> {
|
||||
&mut self.children
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,11 +88,11 @@ impl<S: 'static + Send + Sync> Input<S> {
|
||||
.border()
|
||||
.border_color(border_color_default)
|
||||
.fill(background_color_default)
|
||||
.hover()
|
||||
.border_color(border_color_hover)
|
||||
// .active()
|
||||
// .border_color(border_color_active)
|
||||
.fill(background_color_active)
|
||||
.hover(|h| {
|
||||
h.border_color(border_color_hover)
|
||||
.fill(background_color_active)
|
||||
})
|
||||
// .active(|a| .border_color(border_color_active))
|
||||
.flex()
|
||||
.items_center()
|
||||
.child(
|
||||
@@ -128,7 +128,11 @@ mod stories {
|
||||
}
|
||||
}
|
||||
|
||||
fn render(&mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
|
||||
fn render(
|
||||
&mut self,
|
||||
_view: &mut S,
|
||||
cx: &mut ViewContext<S>,
|
||||
) -> impl Element<ViewState = S> {
|
||||
Story::container(cx)
|
||||
.child(Story::title_for::<_, Input<S>>(cx))
|
||||
.child(Story::label(cx, "Default"))
|
||||
|
||||
@@ -2,7 +2,7 @@ use gpui3::{div, Div};
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
pub trait Stack: StyleHelpers {
|
||||
pub trait Stack: Styled + Sized {
|
||||
/// Horizontally stacks elements.
|
||||
fn h_stack(self) -> Self {
|
||||
self.flex().flex_row().items_center()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pub use gpui3::{
|
||||
div, Element, IntoAnyElement, ParentElement, ScrollState, StyleHelpers, Styled, ViewContext,
|
||||
WindowContext,
|
||||
div, Clickable, Element, Hoverable, IntoAnyElement, ParentElement, ScrollState, Styled,
|
||||
ViewContext, WindowContext,
|
||||
};
|
||||
|
||||
pub use crate::{theme, ButtonVariant, ElementExt, Theme};
|
||||
|
||||
Reference in New Issue
Block a user