-
Notifications
You must be signed in to change notification settings - Fork 616
Update release notes and add deprecation notices for SelectMenu and Dropdown #1887
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
rezrah
merged 8 commits into
next/v35.0.0
from
rezrah/update-deprecated-component-annotations
Feb 25, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2af252e
chore: add deprecation notices for SelectMenu and Dropdown
rezrah db8fadd
fix: deprecated metadata scope in docs
rezrah 35406fd
docs: update release notes for Flex and BorderBox
rezrah e5a4a98
docs: update release notes for Position
rezrah ca1f78e
chore: add deprecated scope to jsx snippets
rezrah 8115e23
chore: add release notes for Dropdown deprecation
rezrah 35b60e5
chore: add Grid release notes
rezrah 215fd3b
update release notes
rezrah 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 |
---|---|---|
@@ -1,5 +1,257 @@ | ||
--- | ||
"@primer/react": major | ||
'@primer/react': major | ||
--- | ||
|
||
Move deprecated components to deprecated folder | ||
### SelectMenu | ||
|
||
⚠️ `SelectMenu` has been deprecated. Please use `ActionMenu` instead. | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<SelectMenu> | ||
<Button as="summary">Projects</Button> | ||
<SelectMenu.Modal> | ||
<SelectMenu.Header>Projects</SelectMenu.Header> | ||
<SelectMenu.List> | ||
<SelectMenu.Item href="#">Primer React bugs</SelectMenu.Item> | ||
<SelectMenu.Item href="#">Primer React roadmap</SelectMenu.Item> | ||
<SelectMenu.Item href="#">Project 3</SelectMenu.Item> | ||
<SelectMenu.Item href="#">Project 4</SelectMenu.Item> | ||
</SelectMenu.List> | ||
</SelectMenu.Modal> | ||
</SelectMenu> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<ActionMenu> | ||
<ActionMenu.Button>Projects</ActionMenu.Button> | ||
<ActionMenu.Overlay> | ||
<ActionList showDividers> | ||
<ActionList.Group title="Projects"> | ||
<ActionList.Item>Primer React bugs</ActionList.Item> | ||
<ActionList.Item>Primer React roadmap</ActionList.Item> | ||
<ActionList.Item>Project three</ActionList.Item> | ||
<ActionList.Item>Project four</ActionList.Item> | ||
</ActionList.Group> | ||
</ActionList> | ||
</ActionMenu.Overlay> | ||
</ActionMenu> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
See [https://primer.style/react/ActionMenu](https://primer.style/react/ActionMenu) for more migration examples. | ||
|
||
### Dropdown | ||
|
||
⚠️ `Dropdown` has been deprecated. Please use `ActionMenu` instead. | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
rezrah marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const fieldTypes = [ | ||
{leadingVisual: TypographyIcon, text: 'Text'}, | ||
{leadingVisual: NumberIcon, text: 'Number'}, | ||
]; | ||
|
||
const [selectedItem, setSelectedItem] = React.useState() | ||
|
||
<DropdownMenu | ||
renderAnchor={({children, ...anchorProps}) => ( | ||
<ButtonInvisible {...anchorProps}> | ||
{children} | ||
</ButtonInvisible> | ||
)} | ||
placeholder="Select a field type" | ||
items={fieldTypes} | ||
selectedItem={selectedItem} | ||
onChange={() => setSelectedIndex(index)} | ||
/> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
const fieldTypes = [ | ||
{icon: <TypographyIcon/>, name: 'Text'}, | ||
{icon: <NumberIcon/>, name: 'Number'}, | ||
]; | ||
|
||
const [selectedItem, setSelectedItem] = React.useState() | ||
|
||
<ActionMenu> | ||
<ActionMenu.Button>{selectedItem ? selectedItem.name : 'Select a field type'}</ActionMenu.Button> | ||
<ActionMenu.Overlay> | ||
<ActionList selectionVariant="single"> | ||
{fieldTypes.map(field => ( | ||
<ActionList.Item onSelect={() => setSelectedItem(field)} key={field.name}> | ||
<ActionList.LeadingVisual>{field.icon}</ActionList.LeadingVisual> | ||
{field.name} | ||
</ActionList.Item> | ||
<ActionList> | ||
</ActionMenu.Overlay> | ||
<ActionMenu> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
See [https://primer.style/react/ActionMenu](https://primer.style/react/ActionMenu) for more migration examples. | ||
|
||
### Flex | ||
|
||
⚠️ `Flex` has been deprecated. Please use [`Box`](https://primer.style/react/Box) instead. | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<Flex flexWrap="nowrap"> | ||
<Box p={3} color="fg.onEmphasis" bg="accent.emphasis"> | ||
Item 1 | ||
</Box> | ||
</Flex> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<Box display="flex" flexWrap="nowrap"> | ||
<Box p={3} color="fg.onEmphasis" bg="accent.emphasis"> | ||
Item 1 | ||
</Box> | ||
</Box> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
### Grid | ||
|
||
⚠️ `Grid` has been deprecated. Please use `ActionMenu` instead. | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<Grid gridTemplateColumns="repeat(2, auto)" gridGap={3}> | ||
<Box p={3} color="fg.onEmphasis" bg="accent.emphasis"> | ||
1 | ||
</Box> | ||
<Box p={3} color="fg.onEmphasis" bg="attention.emphasis"> | ||
2 | ||
</Box> | ||
</Grid> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<Box display="grid" gridTemplateColumns="repeat(2, auto)" gridGap={3}> | ||
<Box p={3} color="fg.onEmphasis" bg="accent.emphasis"> | ||
1 | ||
</Box> | ||
<Box p={3} color="fg.onEmphasis" bg="attention.emphasis"> | ||
2 | ||
</Box> | ||
</Box> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
### BorderBox | ||
|
||
⚠️ `BorderBox` has been deprecated. Please use [`Box`](https://primer.style/react/Box) instead. | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<BorderBox>Item 1</BorderBox> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<Box borderWidth="1px" borderStyle="solid" borderColor="border.default" borderRadius={2}> | ||
Item 1 | ||
</Box> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
### Position | ||
|
||
⚠️ `Position` has been deprecated. Please use [`Box`](https://primer.style/react/Box) instead. | ||
|
||
<table> | ||
<tr> | ||
<th> Before </th> <th> After </th> | ||
</tr> | ||
<tr> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<> | ||
<Position position="absolute">...</Position> | ||
<Absolute>...</Absolute> | ||
<Relative>...</Relative> | ||
<Fixed>...</Fixed> | ||
<Sticky>...</Sticky> | ||
</> | ||
``` | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```jsx | ||
<> | ||
<Box position="absolute">...</Box> | ||
<Box position="absolute">...</Box> | ||
<Box position="relative">...</Box> | ||
<Box position="fixed">...</Box> | ||
<Box position="sticky">...</Box> | ||
</> | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> |
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 |
---|---|---|
|
@@ -12,21 +12,21 @@ Use [Box](/Box) instead. | |
|
||
**Before** | ||
|
||
```jsx | ||
```jsx 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. Love this addition to doctocat <3 |
||
<BorderBox>Item 1</BorderBox> | ||
``` | ||
|
||
**After** | ||
|
||
```jsx | ||
```jsx deprecated | ||
<Box borderWidth="1px" borderStyle="solid" borderColor="border.default" borderRadius={2}> | ||
Item 1 | ||
</Box> | ||
``` | ||
|
||
## Default example | ||
|
||
```jsx live | ||
```jsx live deprecated | ||
<BorderBox>This is a BorderBox</BorderBox> | ||
``` | ||
|
||
|
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
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ status: Deprecated | |
|
||
## Deprecation | ||
|
||
Use [DropdownMenu](/DropdownMenu) instead. | ||
Use [ActionMenu](/ActionMenu) instead. | ||
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. 👍 |
||
|
||
--- | ||
|
||
|
@@ -17,7 +17,7 @@ Dropdown.Menu wraps your menu content. Be sure to pass a `direction` prop to thi | |
|
||
## Default example | ||
|
||
```jsx live | ||
```jsx live deprecated | ||
<Dropdown> | ||
<Dropdown.Button>Dropdown</Dropdown.Button> | ||
<Dropdown.Menu direction="sw"> | ||
|
@@ -30,7 +30,7 @@ Dropdown.Menu wraps your menu content. Be sure to pass a `direction` prop to thi | |
|
||
## With custom button | ||
|
||
```jsx live | ||
```jsx live deprecated | ||
<Dropdown> | ||
<summary> | ||
Dropdown | ||
|
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.
Pointing at the old ActionMenu for now, but once this is merged, this should be the correct one 🤞