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:
parent
db43479be8
commit
123d3ee282
5 changed files with 159 additions and 123 deletions
46
crates/ui/src/components/stories/platform_titlebar.rs
Normal file
46
crates/ui/src/components/stories/platform_titlebar.rs
Normal 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()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue