story: Reorder story menu

This commit is contained in:
Floyd Wang 2025-06-04 19:29:32 +08:00
parent 989e85211a
commit a1bdd50735
3 changed files with 8 additions and 8 deletions

View file

@ -11,11 +11,11 @@ use gpui_component::{
use crate::fixtures::{CHART_DATA, CHART_DATA_2}; use crate::fixtures::{CHART_DATA, CHART_DATA_2};
pub struct PlotStory { pub struct ChartStory {
focus_handle: FocusHandle, focus_handle: FocusHandle,
} }
impl PlotStory { impl ChartStory {
fn new(_: &mut Window, cx: &mut Context<Self>) -> Self { fn new(_: &mut Window, cx: &mut Context<Self>) -> Self {
Self { Self {
focus_handle: cx.focus_handle(), focus_handle: cx.focus_handle(),
@ -27,7 +27,7 @@ impl PlotStory {
} }
} }
impl super::Story for PlotStory { impl super::Story for ChartStory {
fn title() -> &'static str { fn title() -> &'static str {
"Chart" "Chart"
} }
@ -45,7 +45,7 @@ impl super::Story for PlotStory {
} }
} }
impl Focusable for PlotStory { impl Focusable for ChartStory {
fn focus_handle(&self, _: &App) -> FocusHandle { fn focus_handle(&self, _: &App) -> FocusHandle {
self.focus_handle.clone() self.focus_handle.clone()
} }
@ -55,7 +55,7 @@ fn chart_container(
title: &str, title: &str,
chart: impl IntoElement, chart: impl IntoElement,
center: bool, center: bool,
cx: &mut Context<PlotStory>, cx: &mut Context<ChartStory>,
) -> impl IntoElement { ) -> impl IntoElement {
v_flex() v_flex()
.flex_1() .flex_1()
@ -94,7 +94,7 @@ fn chart_container(
) )
} }
impl Render for PlotStory { impl Render for ChartStory {
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
v_flex() v_flex()
.size_full() .size_full()

View file

@ -56,7 +56,7 @@ pub use alert_story::AlertStory;
pub use badge_story::BadgeStory; pub use badge_story::BadgeStory;
pub use button_story::ButtonStory; pub use button_story::ButtonStory;
pub use calendar_story::CalendarStory; pub use calendar_story::CalendarStory;
pub use chart_story::PlotStory; pub use chart_story::ChartStory;
pub use checkbox_story::CheckboxStory; pub use checkbox_story::CheckboxStory;
pub use clipboard_story::ClipboardStory; pub use clipboard_story::ClipboardStory;
pub use color_picker_story::ColorPickerStory; pub use color_picker_story::ColorPickerStory;

View file

@ -42,6 +42,7 @@ impl Gallery {
StoryContainer::panel::<BadgeStory>(window, cx), StoryContainer::panel::<BadgeStory>(window, cx),
StoryContainer::panel::<ButtonStory>(window, cx), StoryContainer::panel::<ButtonStory>(window, cx),
StoryContainer::panel::<CalendarStory>(window, cx), StoryContainer::panel::<CalendarStory>(window, cx),
StoryContainer::panel::<ChartStory>(window, cx),
StoryContainer::panel::<CheckboxStory>(window, cx), StoryContainer::panel::<CheckboxStory>(window, cx),
StoryContainer::panel::<ClipboardStory>(window, cx), StoryContainer::panel::<ClipboardStory>(window, cx),
StoryContainer::panel::<ColorPickerStory>(window, cx), StoryContainer::panel::<ColorPickerStory>(window, cx),
@ -60,7 +61,6 @@ impl Gallery {
StoryContainer::panel::<NotificationStory>(window, cx), StoryContainer::panel::<NotificationStory>(window, cx),
StoryContainer::panel::<NumberInputStory>(window, cx), StoryContainer::panel::<NumberInputStory>(window, cx),
StoryContainer::panel::<OtpInputStory>(window, cx), StoryContainer::panel::<OtpInputStory>(window, cx),
StoryContainer::panel::<PlotStory>(window, cx),
StoryContainer::panel::<PopoverStory>(window, cx), StoryContainer::panel::<PopoverStory>(window, cx),
StoryContainer::panel::<ProgressStory>(window, cx), StoryContainer::panel::<ProgressStory>(window, cx),
StoryContainer::panel::<RadioStory>(window, cx), StoryContainer::panel::<RadioStory>(window, cx),