Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
2af252edb8fadd35406fde5a4a98ca1f78e8115e2335b60e5215fd3bFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| 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.
Uh oh!There was an error while loading. Please reload this page. | ||
| 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> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -12,21 +12,21 @@ Use [Box](/Box) instead. | ||
| **Before** | ||
| ```jsx | ||
| ```jsx deprecated | ||
Contributor 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> | ||
| ``` | ||
| 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. | ||
Member 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 | ||
Uh oh!
There was an error while loading. Please reload this page.
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 🤞