Extract title_bar crate (#13597)

This PR extracts a singular title bar (`title_bar::TitleBar`) from
`ui::TitleBar` and
`collab_ui::collab_titlebar_item::CollabTitlebarItem`.

This is a first step towards organizing title bar things into one place,
and standardizing platform titlebar/window control implementations.

Release Notes:

- N/A
This commit is contained in:
Nate Butler
2024-06-27 19:14:13 -04:00
committed by GitHub
parent 7652a8ae23
commit 0b57df5deb
22 changed files with 756 additions and 655 deletions
@@ -1,56 +0,0 @@
use gpui::{NoAction, Render};
use story::{StoryContainer, StoryItem, StorySection};
use crate::{prelude::*, PlatformStyle, TitleBar};
pub struct TitleBarStory;
impl Render for TitleBarStory {
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
fn add_sample_children(titlebar: TitleBar) -> TitleBar {
titlebar
.child(div().size_2().bg(gpui::red()))
.child(div().size_2().bg(gpui::blue()))
.child(div().size_2().bg(gpui::green()))
}
StoryContainer::new("TitleBar", "crates/ui/src/components/stories/title_bar.rs")
.child(
StorySection::new().child(
StoryItem::new(
"Default (macOS)",
TitleBar::new("macos", Box::new(NoAction))
.platform_style(PlatformStyle::Mac)
.map(add_sample_children),
)
.description("")
.usage(""),
),
)
.child(
StorySection::new().child(
StoryItem::new(
"Default (Linux)",
TitleBar::new("linux", Box::new(NoAction))
.platform_style(PlatformStyle::Linux)
.map(add_sample_children),
)
.description("")
.usage(""),
),
)
.child(
StorySection::new().child(
StoryItem::new(
"Default (Windows)",
TitleBar::new("windows", Box::new(NoAction))
.platform_style(PlatformStyle::Windows)
.map(add_sample_children),
)
.description("")
.usage(""),
),
)
.into_element()
}
}