forked from github/plane
chore: custom menu dropdown improvement (#3599)
* conflict: merge conflict resolved * chore: breadcrumbs component improvement
This commit is contained in:
parent
55afef204d
commit
e69fcd410c
@ -10,7 +10,7 @@ type BreadcrumbsProps = {
|
|||||||
const Breadcrumbs = ({ children }: BreadcrumbsProps) => (
|
const Breadcrumbs = ({ children }: BreadcrumbsProps) => (
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
{React.Children.map(children, (child, index) => (
|
{React.Children.map(children, (child, index) => (
|
||||||
<div key={index} className="flex flex-wrap items-center gap-2.5">
|
<div key={index} className="flex items-center gap-2.5">
|
||||||
{child}
|
{child}
|
||||||
{index !== React.Children.count(children) - 1 && (
|
{index !== React.Children.count(children) - 1 && (
|
||||||
<ChevronRight className="h-3.5 w-3.5 flex-shrink-0 text-custom-text-400" aria-hidden="true" />
|
<ChevronRight className="h-3.5 w-3.5 flex-shrink-0 text-custom-text-400" aria-hidden="true" />
|
||||||
|
@ -48,7 +48,13 @@ const CustomMenu = (props: ICustomMenuDropdownProps) => {
|
|||||||
if (referenceElement) referenceElement.focus();
|
if (referenceElement) referenceElement.focus();
|
||||||
};
|
};
|
||||||
const closeDropdown = () => setIsOpen(false);
|
const closeDropdown = () => setIsOpen(false);
|
||||||
|
|
||||||
const handleKeyDown = useDropdownKeyDown(openDropdown, closeDropdown, isOpen);
|
const handleKeyDown = useDropdownKeyDown(openDropdown, closeDropdown, isOpen);
|
||||||
|
|
||||||
|
const handleOnClick = () => {
|
||||||
|
if (closeOnSelect) closeDropdown();
|
||||||
|
};
|
||||||
|
|
||||||
useOutsideClickDetector(dropdownRef, closeDropdown);
|
useOutsideClickDetector(dropdownRef, closeDropdown);
|
||||||
|
|
||||||
let menuItems = (
|
let menuItems = (
|
||||||
@ -90,6 +96,7 @@ const CustomMenu = (props: ICustomMenuDropdownProps) => {
|
|||||||
tabIndex={tabIndex}
|
tabIndex={tabIndex}
|
||||||
className={cn("relative w-min text-left", className)}
|
className={cn("relative w-min text-left", className)}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
|
onClick={handleOnClick}
|
||||||
>
|
>
|
||||||
{({ open }) => (
|
{({ open }) => (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user