thaw-ui / thaw

An easy to use leptos component library
https://thawui.vercel.app
MIT License
206 stars 21 forks source link

Feature/dropdown #210

Closed kandrelczyk closed 1 week ago

kandrelczyk commented 1 week ago

Adding dropdown component. For now it's just a basic list with optional icon and disabled option.

luoxiaozero commented 1 week ago

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

kandrelczyk commented 1 week ago

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 call_on_click_outside method which is a common code between dropdown and popover but forgot to extract it. Now it's in utils and can be also used in future popselect and popconfirm components.

Let me know what you think. If this is fine I will update documentation.

luoxiaozero commented 1 week ago

The call_on_click_outside method is fine, but there are a few hiccups at the moment. https://github.com/thaw-ui/thaw/pull/210#discussion_r1651876253

kandrelczyk commented 1 week ago

I think that's it. Demo page is also updated. Let me know if anything still needs fixing.