-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/dropdown #210
Feature/dropdown #210
Conversation
I think it's a bit weird that the Dropdown popup doesn't close when clicking on the DropdownItem. Also, I think it would be better to remove the click event of the DropdownItem and add an on_select event to the Dropdown instead. https://www.naiveui.com/en-US/os-theme/components/dropdown#basic.vue |
Please take a look at this. Since we don't want to close the dropdown when clicking on disabled item I had to keep the previous closing method and add automatic close when on_select is called. In previous commit I also introduced the Let me know what you think. If this is fine I will update documentation. |
demo_markdown/docs/dropdown/mod.md
Outdated
# Dropdown | ||
|
||
```rust demo | ||
let value = create_rw_signal(None::<String>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can delete this line.
thaw_utils/src/on_click_outside.rs
Outdated
if current_el == *body { | ||
break; | ||
}; | ||
let Some(dropdown_el) = element.get_untracked() else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dropdown_el
can be changed to a generic name.
{ | ||
let handle = window_event_listener(ev::click, move |ev| { | ||
use leptos::wasm_bindgen::__rt::IntoJsResult; | ||
if trigger_type != PopoverTriggerType::Click { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This judgment logic is not reflected in call_on_click_outside
, resulting in Hover mode, click the button can also close the pop-up window.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this condition outside of call_on_click_outside
so that for Hover trigger type the event is not set at all. Is that ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
thaw/src/dropdown/dropdown.css
Outdated
transform-origin: inherit; | ||
} | ||
|
||
.thaw-dropdown-trigger { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can delete this line.
thaw/src/dropdown/mod.rs
Outdated
use thaw_components::{Binder, CSSTransition, Follower, FollowerPlacement}; | ||
pub use theme::DropdownTheme; | ||
|
||
use leptos::{html::Div, leptos_dom::helpers::TimeoutHandle, *}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import: html::Div
The |
I think that's it. Demo page is also updated. Let me know if anything still needs fixing. |
Adding dropdown component. For now it's just a basic list with optional icon and disabled option.