diff --git a/README.md b/README.md index ed97beb1..ae7d92dc 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,9 @@ A UI components for building desktop application by using [GPUI](https://gpui.rs - [x] Column resizing - [x] Column ordering - [x] Column sorting +- [x] Menu + - [x] Popup Menu + - [x] Context Menu - [ ] Drawer - [ ] Modal diff --git a/crates/app/src/story_workspace.rs b/crates/app/src/story_workspace.rs index 557b200d..8472d7b0 100644 --- a/crates/app/src/story_workspace.rs +++ b/crates/app/src/story_workspace.rs @@ -2,7 +2,7 @@ use gpui::*; use prelude::FluentBuilder as _; use story::{ ButtonStory, DropdownStory, IconStory, ImageStory, InputStory, ListStory, PickerStory, - PopoverStory, ProgressStory, ResizableStory, ScrollableStory, StoryContainer, SwitchStory, + PopupStory, ProgressStory, ResizableStory, ScrollableStory, StoryContainer, SwitchStory, TableStory, TextStory, TooltipStory, }; use workspace::{TitleBar, Workspace}; @@ -96,9 +96,9 @@ impl StoryWorkspace { .detach(); StoryContainer::add_pane( - "Popover", - "Displays rich content in a portal, triggered by a button.", - PopoverStory::view(cx).into(), + "Popup", + "A popup displays content on top of the main page.", + PopupStory::view(cx).into(), workspace.clone(), cx, ) diff --git a/crates/story/src/lib.rs b/crates/story/src/lib.rs index 26224a9a..eeff914a 100644 --- a/crates/story/src/lib.rs +++ b/crates/story/src/lib.rs @@ -5,7 +5,7 @@ mod image_story; mod input_story; mod list_story; mod picker_story; -mod popover_story; +mod popup_story; mod progress_story; mod resizable_story; mod scrollable_story; @@ -22,7 +22,7 @@ pub use image_story::ImageStory; pub use input_story::InputStory; pub use list_story::ListStory; pub use picker_story::PickerStory; -pub use popover_story::PopoverStory; +pub use popup_story::PopupStory; pub use progress_story::ProgressStory; pub use resizable_story::ResizableStory; pub use scrollable_story::ScrollableStory; diff --git a/crates/story/src/popover_story.rs b/crates/story/src/popup_story.rs similarity index 91% rename from crates/story/src/popover_story.rs rename to crates/story/src/popup_story.rs index aac40fa7..e163c6c9 100644 --- a/crates/story/src/popover_story.rs +++ b/crates/story/src/popup_story.rs @@ -5,6 +5,7 @@ use gpui::{ }; use ui::{ button::Button, + context_menu::ContextMenuExt, divider::Divider, h_flex, input::TextInput, @@ -50,20 +51,21 @@ impl Render for Form { .child(self.input1.clone()) .child( Button::new("submit", cx) + .label("Submit") .primary() .on_click(cx.listener(|_, _, cx| cx.emit(DismissEvent))), ) } } -pub struct PopoverStory { +pub struct PopupStory { focus_handle: FocusHandle, form: View