-
Notifications
You must be signed in to change notification settings - Fork 616
Deprecate ActionMenu v1 & Promote drafts/ActionMenu v2 #1895
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e034954
Deprecate ActionList v1
siddharthkp 3d67182
Promote drafts/ActionList2 to main/ActionList
siddharthkp 24bc583
Add changelog
siddharthkp aab2fc8
Undo package-lock change
siddharthkp eea615e
update ActionList import for Menu2 docs
siddharthkp 5d618c2
Deprecate ActionMenu - part 1
siddharthkp 05818fa
Deprecate ActionMenu - part 2
siddharthkp c78fa15
Promote drafts/ActionMenu2 to main/ActionMenu
siddharthkp 96085cc
Add changelog
siddharthkp f7fbac9
Add @deprecated on deprecated/ActionMenu
siddharthkp d642d32
docs fixed!
siddharthkp 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
'@primer/react': major | ||
--- | ||
|
||
### ActionMenu | ||
|
||
ActionMenu now ships a composable API that utilises ActionList | ||
|
||
See full list of props and examples: https://primer.style/react/ActionMenu | ||
|
||
Main changes: | ||
|
||
1. Instead of using `items` prop, use `ActionList` inside `ActionMenu` | ||
2. Instead of using `anchorContent` on `ActionMenu`, use `ActionMenu.Button` with `children` | ||
3. Instead of using `onAction` prop on `ActionMenu`, use `onSelect` prop on `ActionList.Item` | ||
4. Instead of using `groupMetadata` on `ActionMenu`, use `ActionList.Group` | ||
5. Instead of `overlayProps` on `ActionMenu`, use `ActionMenu.Overlay` | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<ActionMenu | ||
anchorContent="Menu" | ||
onAction={fn} | ||
items={[ | ||
{text: 'New file'}, | ||
{text: 'Copy link'}, | ||
{text: 'Edit file'}, | ||
ActionMenu.Divider, | ||
{text: 'Delete file', variant: 'danger'} | ||
]} | ||
overlayProps={{width: 'small'}} | ||
/> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<ActionMenu> | ||
<ActionMenu.Button>Menu</ActionMenu.Button> | ||
<ActionMenu.Overlay width="small"> | ||
<ActionList> | ||
<ActionList.Item onSelect={fn}>New file</ActionList.Item> | ||
<ActionList.Item>Copy link</ActionList.Item> | ||
<ActionList.Item>Edit file</ActionList.Item> | ||
<ActionList.Divider /> | ||
<ActionList.Item variant="danger">Delete file</ActionList.Item> | ||
</ActionList> | ||
</ActionMenu.Overlay> | ||
</ActionMenu> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
To continue to use the deprecated API for now, change the import path to `@primer/react/deprecated`: | ||
|
||
```js | ||
import {ActionMenu} from '@primer/react/deprecated' | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the codemod bit here too? |
This file contains hidden or 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.