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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
69 changed files with 271 additions and 271 deletions

View file

@ -9,7 +9,7 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::SettingsStore;
use std::sync::Arc;
use ui::{h_stack, ContextMenu, IconButton, Tooltip};
use ui::{h_flex, ContextMenu, IconButton, Tooltip};
use ui::{prelude::*, right_click_menu};
const RESIZE_HANDLE_SIZE: Pixels = Pixels(6.);
@ -682,7 +682,7 @@ impl Render for PanelButtons {
)
});
h_stack().gap_0p5().children(buttons)
h_flex().gap_0p5().children(buttons)
}
}

View file

@ -2,7 +2,7 @@ use gpui::{
div, prelude::*, px, AnyView, DismissEvent, FocusHandle, ManagedView, Render, Subscription,
View, ViewContext, WindowContext,
};
use ui::{h_stack, v_stack};
use ui::{h_flex, v_flex};
pub trait ModalView: ManagedView {
fn on_before_dismiss(&mut self, _: &mut ViewContext<Self>) -> bool {
@ -120,7 +120,7 @@ impl Render for ModalLayer {
.left_0()
.z_index(169)
.child(
v_stack()
v_flex()
.h(px(0.0))
.top_20()
.flex()
@ -128,7 +128,7 @@ impl Render for ModalLayer {
.items_center()
.track_focus(&active_modal.focus_handle)
.child(
h_stack()
h_flex()
.on_mouse_down_out(cx.listener(|this, _, cx| {
this.hide_modal(cx);
}))

View file

@ -173,7 +173,7 @@ pub mod simple_message_notification {
};
use std::sync::Arc;
use ui::prelude::*;
use ui::{h_stack, v_stack, Button, Icon, IconName, Label, StyledExt};
use ui::{h_flex, v_flex, Button, Icon, IconName, Label, StyledExt};
pub struct MessageNotification {
message: SharedString,
@ -218,11 +218,11 @@ pub mod simple_message_notification {
impl Render for MessageNotification {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
v_stack()
v_flex()
.elevation_3(cx)
.p_4()
.child(
h_stack()
h_flex()
.justify_between()
.child(div().max_w_80().child(Label::new(self.message.clone())))
.child(

View file

@ -35,7 +35,7 @@ use ui::{
prelude::*, right_click_menu, ButtonSize, Color, IconButton, IconButtonShape, IconName,
IconSize, Indicator, Label, Tab, TabBar, TabPosition, Tooltip,
};
use ui::{v_stack, ContextMenu};
use ui::{v_flex, ContextMenu};
use util::{maybe, truncate_and_remove_front, ResultExt};
#[derive(PartialEq, Clone, Copy, Deserialize, Debug)]
@ -271,7 +271,7 @@ impl Pane {
custom_drop_handle: None,
can_split: true,
render_tab_bar_buttons: Rc::new(move |pane, cx| {
h_stack()
h_flex()
.gap_2()
.child(
IconButton::new("plus", IconName::Plus)
@ -1444,7 +1444,7 @@ impl Pane {
.track_scroll(self.tab_bar_scroll_handle.clone())
.when(self.display_nav_history_buttons, |tab_bar| {
tab_bar.start_child(
h_stack()
h_flex()
.gap_2()
.child(
IconButton::new("navigate_backward", IconName::ArrowLeft)
@ -1718,7 +1718,7 @@ impl FocusableView for Pane {
impl Render for Pane {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
v_stack()
v_flex()
.key_context("Pane")
.track_focus(&self.focus_handle)
.size_full()

View file

@ -12,7 +12,7 @@ use gpui::{
WindowContext,
};
use std::sync::{Arc, Weak};
use ui::{h_stack, prelude::*, Icon, IconName, Label};
use ui::{h_flex, prelude::*, Icon, IconName, Label};
pub enum Event {
Close,
@ -98,7 +98,7 @@ impl Item for SharedScreen {
selected: bool,
_: &WindowContext<'_>,
) -> gpui::AnyElement {
h_stack()
h_flex()
.gap_1()
.child(Icon::new(IconName::Screen))
.child(

View file

@ -4,7 +4,7 @@ use gpui::{
WindowContext,
};
use std::any::TypeId;
use ui::{h_stack, prelude::*};
use ui::{h_flex, prelude::*};
use util::ResultExt;
pub trait StatusItemView: Render {
@ -50,14 +50,14 @@ impl Render for StatusBar {
impl StatusBar {
fn render_left_tools(&self, _: &mut ViewContext<Self>) -> impl IntoElement {
h_stack()
h_flex()
.items_center()
.gap_2()
.children(self.left_items.iter().map(|item| item.to_any()))
}
fn render_right_tools(&self, _: &mut ViewContext<Self>) -> impl IntoElement {
h_stack()
h_flex()
.items_center()
.gap_2()
.children(self.right_items.iter().rev().map(|item| item.to_any()))

View file

@ -4,7 +4,7 @@ use gpui::{
WindowContext,
};
use ui::prelude::*;
use ui::{h_stack, v_stack};
use ui::{h_flex, v_flex};
pub enum ToolbarItemEvent {
ChangeLocation(ToolbarItemLocation),
@ -103,18 +103,18 @@ impl Render for Toolbar {
let has_left_items = self.left_items().count() > 0;
let has_right_items = self.right_items().count() > 0;
v_stack()
v_flex()
.p_2()
.when(has_left_items || has_right_items, |this| this.gap_2())
.border_b()
.border_color(cx.theme().colors().border_variant)
.bg(cx.theme().colors().toolbar_background)
.child(
h_stack()
h_flex()
.justify_between()
.when(has_left_items, |this| {
this.child(
h_stack()
h_flex()
.flex_1()
.justify_start()
.children(self.left_items().map(|item| item.to_any())),
@ -122,7 +122,7 @@ impl Render for Toolbar {
})
.when(has_right_items, |this| {
this.child(
h_stack()
h_flex()
.flex_1()
.justify_end()
.children(self.right_items().map(|item| item.to_any())),