-
Notifications
You must be signed in to change notification settings - Fork 43
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
🌱 1241 replace deprecated pf dropdown #1375
Merged
gitdallas
merged 11 commits into
konveyor:main
from
gitdallas:chore/1241-replace-deprecated-pf-dropdown
Sep 26, 2023
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0cd7185
chore: 1241 replace deprecated pf dropdowns
gitdallas 84c2557
replace deprecated dropdown in menuactions
gitdallas 19dc2be
replace deprecated dropdown in bulkselector
gitdallas b3d7eda
replace deprecated dropdown in filtertoolbar
gitdallas a93d4cf
replace deprecated dropdown in mobiledropdown
gitdallas fcf3f16
replace deprecated dropdown in ssomenu
gitdallas 724c723
replace deprecated dropdown in manage-imports
gitdallas 18a4a8d
update snaps for dropdown deprecation refactor
gitdallas c257821
self close tag
gitdallas a57dcd4
Merge branch 'main' into chore/1241-replace-deprecated-pf-dropdown
gitdallas ec0abce
Merge branch 'main' into chore/1241-replace-deprecated-pf-dropdown
gitdallas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 seems counterintuitive to me.
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.
when a selection is made, we want to close the dropdown
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.
Just struck me as odd that there are no other actions involved in the select handler other than closing the dropdown. I think this component may be deprecated.
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.
the dropdown items have their own. i suppose this is part of being composable and having more flexibility. could make the dropdown item have an onclick with
() => setIsOpen(false); item.callback();
, but then would have to pass the args too instead of just puttingitem.callback
in there. it's nice that it can be handled by the dropdown for all selections.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.
+1 - After looking into this, seems that there are never any menuActions passed to the PageHeader component. I think this is a leftover component that just never got deleted.