-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate ActionMenu v1 & Promote drafts/ActionMenu v2 (#1897)
* Deprecate ActionList v1 * Promote drafts/ActionList2 to main/ActionList * Add changelog * Undo package-lock change * update ActionList import for Menu2 docs * Deprecate ActionMenu - part 1 * Deprecate ActionMenu - part 2 * Promote drafts/ActionMenu2 to main/ActionMenu * Add changelog * Add @deprecated on deprecated/ActionMenu * docs fixed! * reorder deprecated components alphabetically * Update deprecation message * Fix missing icon that only broke on this PR for some reason
- Loading branch information
1 parent
17ef5ef
commit d402357
Showing
28 changed files
with
1,340 additions
and
1,078 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
'@primer/react': major | ||
--- | ||
|
||
### ActionMenu | ||
|
||
ActionMenu has been rewritten with a composable API, design updates and accessibility fixes. | ||
|
||
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 (v34)</th> <th> After (v35)</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' | ||
``` | ||
|
||
You can use the [one-time codemod](https://github.com/primer/react-migrate#readme) to change your import statements automatically. |
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.