Rearrange to hopefully make merging easier
This commit is contained in:
@@ -16,9 +16,9 @@ pub struct Avatar {
|
||||
}
|
||||
|
||||
impl RenderOnce for Avatar {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(mut self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(mut self, cx: &mut WindowContext) -> Self::Output {
|
||||
if self.image.style().corner_radii.top_left.is_none() {
|
||||
self = self.shape(Shape::Circle);
|
||||
}
|
||||
|
||||
@@ -136,9 +136,9 @@ impl ButtonCommon for Button {
|
||||
}
|
||||
|
||||
impl RenderOnce for Button {
|
||||
type Rendered = ButtonLike;
|
||||
type Output = ButtonLike;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
let is_disabled = self.base.disabled;
|
||||
let is_selected = self.base.selected;
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ impl Selectable for ButtonIcon {
|
||||
}
|
||||
|
||||
impl RenderOnce for ButtonIcon {
|
||||
type Rendered = IconElement;
|
||||
type Output = IconElement;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
let icon = self
|
||||
.selected_icon
|
||||
.filter(|_| self.selected)
|
||||
|
||||
@@ -363,9 +363,9 @@ impl ParentElement for ButtonLike {
|
||||
}
|
||||
|
||||
impl RenderOnce for ButtonLike {
|
||||
type Rendered = Stateful<Div>;
|
||||
type Output = Stateful<Div>;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
self.base
|
||||
.h_flex()
|
||||
.id(self.id.clone())
|
||||
|
||||
@@ -106,9 +106,9 @@ impl VisibleOnHover for IconButton {
|
||||
}
|
||||
|
||||
impl RenderOnce for IconButton {
|
||||
type Rendered = ButtonLike;
|
||||
type Output = ButtonLike;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
let is_disabled = self.base.disabled;
|
||||
let is_selected = self.base.selected;
|
||||
|
||||
|
||||
@@ -99,9 +99,9 @@ impl ButtonCommon for ToggleButton {
|
||||
}
|
||||
|
||||
impl RenderOnce for ToggleButton {
|
||||
type Rendered = ButtonLike;
|
||||
type Output = ButtonLike;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
let is_disabled = self.base.disabled;
|
||||
let is_selected = self.base.selected;
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ pub struct Checkbox {
|
||||
}
|
||||
|
||||
impl RenderOnce for Checkbox {
|
||||
type Rendered = gpui::Stateful<Div>;
|
||||
type Output = gpui::Stateful<Div>;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
let group_id = format!("checkbox_group_{:?}", self.id);
|
||||
|
||||
let icon = match self.checked {
|
||||
|
||||
@@ -28,9 +28,9 @@ impl Disclosure {
|
||||
}
|
||||
|
||||
impl RenderOnce for Disclosure {
|
||||
type Rendered = IconButton;
|
||||
type Output = IconButton;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
IconButton::new(
|
||||
self.id,
|
||||
match self.is_open {
|
||||
|
||||
@@ -31,9 +31,9 @@ pub struct Divider {
|
||||
}
|
||||
|
||||
impl RenderOnce for Divider {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
div()
|
||||
.map(|this| match self.direction {
|
||||
DividerDirection::Horizontal => {
|
||||
|
||||
@@ -196,9 +196,9 @@ pub struct IconElement {
|
||||
}
|
||||
|
||||
impl RenderOnce for IconElement {
|
||||
type Rendered = Svg;
|
||||
type Output = Svg;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
svg()
|
||||
.size(self.size.rems())
|
||||
.flex_none()
|
||||
|
||||
@@ -45,9 +45,9 @@ impl Indicator {
|
||||
}
|
||||
|
||||
impl RenderOnce for Indicator {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
div()
|
||||
.flex_none()
|
||||
.map(|this| match self.style {
|
||||
|
||||
@@ -11,9 +11,9 @@ pub struct KeyBinding {
|
||||
}
|
||||
|
||||
impl RenderOnce for KeyBinding {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
h_stack()
|
||||
.flex_none()
|
||||
.gap_2()
|
||||
@@ -91,9 +91,9 @@ pub struct Key {
|
||||
}
|
||||
|
||||
impl RenderOnce for Key {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
let single_char = self.key.len() == 1;
|
||||
|
||||
div()
|
||||
@@ -125,9 +125,9 @@ pub struct KeyIcon {
|
||||
}
|
||||
|
||||
impl RenderOnce for KeyIcon {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
div()
|
||||
.w(rems(14. / 16.))
|
||||
.child(IconElement::new(self.icon).size(IconSize::Small))
|
||||
|
||||
@@ -46,9 +46,9 @@ impl LabelCommon for HighlightedLabel {
|
||||
}
|
||||
|
||||
impl RenderOnce for HighlightedLabel {
|
||||
type Rendered = LabelLike;
|
||||
type Output = LabelLike;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
let highlight_color = cx.theme().colors().text_accent;
|
||||
|
||||
let mut highlight_indices = self.highlight_indices.iter().copied().peekable();
|
||||
|
||||
@@ -40,9 +40,9 @@ impl LabelCommon for Label {
|
||||
}
|
||||
|
||||
impl RenderOnce for Label {
|
||||
type Rendered = LabelLike;
|
||||
type Output = LabelLike;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
self.base.child(self.label)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ impl ParentElement for LabelLike {
|
||||
}
|
||||
|
||||
impl RenderOnce for LabelLike {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
div()
|
||||
.when(self.strikethrough, |this| {
|
||||
this.relative().child(
|
||||
|
||||
@@ -46,9 +46,9 @@ impl ParentElement for List {
|
||||
}
|
||||
|
||||
impl RenderOnce for List {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
v_stack().w_full().py_1().children(self.header).map(|this| {
|
||||
match (self.children.is_empty(), self.toggle) {
|
||||
(false, _) => this.children(self.children),
|
||||
|
||||
@@ -76,9 +76,9 @@ impl Selectable for ListHeader {
|
||||
}
|
||||
|
||||
impl RenderOnce for ListHeader {
|
||||
type Rendered = Stateful<Div>;
|
||||
type Output = Stateful<Div>;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
h_stack()
|
||||
.id(self.label.clone())
|
||||
.w_full()
|
||||
|
||||
@@ -147,9 +147,9 @@ impl ParentElement for ListItem {
|
||||
}
|
||||
|
||||
impl RenderOnce for ListItem {
|
||||
type Rendered = Stateful<Div>;
|
||||
type Output = Stateful<Div>;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
h_stack()
|
||||
.id(self.id)
|
||||
.w_full()
|
||||
|
||||
@@ -6,9 +6,9 @@ use crate::prelude::*;
|
||||
pub struct ListSeparator;
|
||||
|
||||
impl RenderOnce for ListSeparator {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
div()
|
||||
.h_px()
|
||||
.w_full()
|
||||
|
||||
@@ -26,9 +26,9 @@ impl ListSubHeader {
|
||||
}
|
||||
|
||||
impl RenderOnce for ListSubHeader {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, _cx: &mut WindowContext) -> Self::Output {
|
||||
h_stack().flex_1().w_full().relative().py_1().child(
|
||||
div()
|
||||
.h_6()
|
||||
|
||||
@@ -41,9 +41,9 @@ pub struct Popover {
|
||||
}
|
||||
|
||||
impl RenderOnce for Popover {
|
||||
type Rendered = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
div()
|
||||
.flex()
|
||||
.gap_1()
|
||||
|
||||
@@ -93,9 +93,9 @@ impl ParentElement for Tab {
|
||||
}
|
||||
|
||||
impl RenderOnce for Tab {
|
||||
type Rendered = Stateful<Div>;
|
||||
type Output = Stateful<Div>;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
let (text_color, tab_bg, _tab_hover_bg, _tab_active_bg) = match self.selected {
|
||||
false => (
|
||||
cx.theme().colors().text_muted,
|
||||
|
||||
@@ -89,9 +89,9 @@ impl ParentElement for TabBar {
|
||||
}
|
||||
|
||||
impl RenderOnce for TabBar {
|
||||
type Rendered = Stateful<Div>;
|
||||
type Output = Stateful<Div>;
|
||||
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
|
||||
fn render(self, cx: &mut WindowContext) -> Self::Output {
|
||||
const HEIGHT_IN_REMS: f32 = 30. / 16.;
|
||||
|
||||
div()
|
||||
|
||||
Reference in New Issue
Block a user