ui: Clean up PlatformTitlebar implementation (#9413)

This PR cleans up the implementation of the `PlatformTitlebar` component
to better match our conventions for building UI components.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-15 14:31:02 -04:00 committed by GitHub
parent db43479be8
commit 123d3ee282
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 159 additions and 123 deletions

View file

@ -0,0 +1,46 @@
use gpui::Render;
use story::{StoryContainer, StoryItem, StorySection};
use crate::{prelude::*, PlatformStyle, PlatformTitlebar};
pub struct PlatformTitlebarStory;
impl Render for PlatformTitlebarStory {
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
StoryContainer::new(
"Platform Titlebar",
"crates/ui/src/components/stories/platform_titlebar.rs",
)
.child(
StorySection::new().child(
StoryItem::new(
"Default (macOS)",
PlatformTitlebar::new("macos").platform_style(PlatformStyle::MacOs),
)
.description("")
.usage(""),
),
)
.child(
StorySection::new().child(
StoryItem::new(
"Default (Linux)",
PlatformTitlebar::new("linux").platform_style(PlatformStyle::Linux),
)
.description("")
.usage(""),
),
)
.child(
StorySection::new().child(
StoryItem::new(
"Default (Windows)",
PlatformTitlebar::new("windows").platform_style(PlatformStyle::Windows),
)
.description("")
.usage(""),
),
)
.into_element()
}
}