-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into table-local-url-params
- Loading branch information
Showing
31 changed files
with
968 additions
and
867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,43 @@ | ||
import React, { useState } from "react"; | ||
|
||
import { Dropdown, KebabToggle } from "@patternfly/react-core/deprecated"; | ||
import { | ||
Dropdown, | ||
DropdownList, | ||
MenuToggle, | ||
MenuToggleElement, | ||
} from "@patternfly/react-core"; | ||
import EllipsisVIcon from "@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon"; | ||
|
||
export interface IKebabDropdownProps { | ||
dropdownItems?: React.ReactNode[]; | ||
ariaLabel?: string; | ||
} | ||
|
||
export const KebabDropdown: React.FC<IKebabDropdownProps> = ({ | ||
dropdownItems, | ||
ariaLabel, | ||
}) => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const onKebabToggle = (isOpen: boolean) => { | ||
setIsOpen(isOpen); | ||
}; | ||
|
||
return ( | ||
<Dropdown | ||
toggle={<KebabToggle onToggle={(_, isOpen) => onKebabToggle(isOpen)} />} | ||
popperProps={{ position: "right" }} | ||
isOpen={isOpen} | ||
isPlain | ||
position="right" | ||
dropdownItems={dropdownItems} | ||
/> | ||
onOpenChange={(isOpen) => setIsOpen(isOpen)} | ||
toggle={(toggleRef: React.Ref<MenuToggleElement>) => ( | ||
<MenuToggle | ||
ref={toggleRef} | ||
isExpanded={isOpen} | ||
onClick={() => setIsOpen(!isOpen)} | ||
variant="plain" | ||
aria-label={ariaLabel || "Table toolbar actions kebab toggle"} | ||
isDisabled={!dropdownItems || dropdownItems.length === 0} | ||
> | ||
<EllipsisVIcon aria-hidden="true" /> | ||
</MenuToggle> | ||
)} | ||
> | ||
<DropdownList>{dropdownItems}</DropdownList> | ||
</Dropdown> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.