Rename h_stack and v_stack to h_flex and v_flex, respectively (#4053)

This PR renames the `h_stack` and `v_stack` to `h_flex` and `v_flex`,
respectively.

We were previously using `h_stack` and `v_stack` to match SwiftUI, but
`h_flex` and `v_flex` fit better with the web/flexbox terminology that
the rest of GPUI uses.

Additionally, we were already calling the utility functions used to
implement `h_stack` and `v_stack` by the new names.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2024-01-15 11:34:06 -05:00
committed by GitHub
parent b136d21ebf
commit 90f4c70a82
69 changed files with 271 additions and 271 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
use gpui::AnyElement;
use smallvec::SmallVec;
use crate::{prelude::*, v_stack, Label, ListHeader};
use crate::{prelude::*, v_flex, Label, ListHeader};
#[derive(IntoElement)]
pub struct List {
@@ -47,7 +47,7 @@ impl ParentElement for List {
impl RenderOnce for List {
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
v_stack().w_full().py_1().children(self.header).map(|this| {
v_flex().w_full().py_1().children(self.header).map(|this| {
match (self.children.is_empty(), self.toggle) {
(false, _) => this.children(self.children),
(true, Some(false)) => this,
+4 -4
View File
@@ -1,4 +1,4 @@
use crate::{h_stack, prelude::*, Disclosure, Label};
use crate::{h_flex, prelude::*, Disclosure, Label};
use gpui::{AnyElement, ClickEvent};
#[derive(IntoElement)]
@@ -76,7 +76,7 @@ impl Selectable for ListHeader {
impl RenderOnce for ListHeader {
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
h_stack()
h_flex()
.id(self.label.clone())
.w_full()
.relative()
@@ -95,7 +95,7 @@ impl RenderOnce for ListHeader {
.w_full()
.gap_1()
.child(
h_stack()
h_flex()
.gap_1()
.children(self.toggle.map(|is_open| {
Disclosure::new("toggle", is_open).on_toggle(self.on_toggle)
@@ -109,7 +109,7 @@ impl RenderOnce for ListHeader {
.child(Label::new(self.label.clone()).color(Color::Muted)),
),
)
.child(h_stack().children(self.end_slot))
.child(h_flex().children(self.end_slot))
.when_some(self.end_hover_slot, |this, end_hover_slot| {
this.child(
div()
+6 -6
View File
@@ -146,7 +146,7 @@ impl ParentElement for ListItem {
impl RenderOnce for ListItem {
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
h_stack()
h_flex()
.id(self.id)
.w_full()
.relative()
@@ -169,7 +169,7 @@ impl RenderOnce for ListItem {
})
})
.child(
h_stack()
h_flex()
.id("inner_list_item")
.w_full()
.relative()
@@ -219,9 +219,9 @@ impl RenderOnce for ListItem {
.child(Disclosure::new("toggle", is_open).on_toggle(self.on_toggle))
}))
.child(
h_stack()
h_flex()
// HACK: We need to set *any* width value here in order for this container to size correctly.
// Without this the `h_stack` will overflow the parent `inner_list_item`.
// Without this the `h_flex` will overflow the parent `inner_list_item`.
.w_px()
.flex_1()
.gap_1()
@@ -230,7 +230,7 @@ impl RenderOnce for ListItem {
)
.when_some(self.end_slot, |this, end_slot| {
this.justify_between().child(
h_stack()
h_flex()
.when(self.end_hover_slot.is_some(), |this| {
this.visible()
.group_hover("list_item", |this| this.invisible())
@@ -240,7 +240,7 @@ impl RenderOnce for ListItem {
})
.when_some(self.end_hover_slot, |this, end_hover_slot| {
this.child(
h_stack()
h_flex()
.h_full()
.absolute()
.right_2()
@@ -1,5 +1,5 @@
use crate::prelude::*;
use crate::{h_stack, Icon, IconName, IconSize, Label};
use crate::{h_flex, Icon, IconName, IconSize, Label};
#[derive(IntoElement)]
pub struct ListSubHeader {
@@ -25,7 +25,7 @@ impl ListSubHeader {
impl RenderOnce for ListSubHeader {
fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
h_stack().flex_1().w_full().relative().py_1().child(
h_flex().flex_1().w_full().relative().py_1().child(
div()
.h_6()
.when(self.inset, |this| this.px_2())