This commit is contained in:
Antonio Scandurra
2023-10-17 13:32:49 +02:00
parent 488d08b43c
commit c04171abf6
16 changed files with 251 additions and 302 deletions
+1 -1
View File
@@ -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,
+1 -3
View File
@@ -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
}
}
+1 -3
View File
@@ -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
}
}
+1 -3
View File
@@ -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
}
}
+10 -6
View File
@@ -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"))
+1 -1
View File
@@ -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()
+2 -2
View File
@@ -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};