Skip to content
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

Prefix component with types exported from ActionList2 and ActionMenu2 #1883

Merged
merged 3 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changeset/actionlist2-actionmenu2-prefix-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'@primer/react': major
---

`ActionList2` exported types are now prefixed with `ActionList`:

```
ListProps → ActionListProps
GroupProps → ActionListGroupProps
ItemProps → ActionListItemProps
DescriptionProps → ActionListDescriptionProps
LeadingVisualProps → ActionListLeadingVisualProps,
TrailingVisualProps → ActionListTrailingVisualProps
```

`ActionMenu2` exported types are now prefixed with `ActionMenu`:

```
MenuButtonProps → ActionMenuButtonProps
MenuAnchorProps → ActionMenuAnchorProps
```
11 changes: 7 additions & 4 deletions src/ActionList2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import {Description} from './Description'
import {LeadingVisual, TrailingVisual} from './Visuals'

export type {ListProps as ActionListProps} from './List'
export type {GroupProps} from './Group'
export type {ItemProps} from './Item'
export type {DescriptionProps} from './Description'
export type {LeadingVisualProps, TrailingVisualProps} from './Visuals'
export type {GroupProps as ActionListGroupProps} from './Group'
export type {ItemProps as ActionListItemProps} from './Item'
export type {DescriptionProps as ActionListDescriptionProps} from './Description'
export type {
LeadingVisualProps as ActionListLeadingVisualProps,
TrailingVisualProps as ActionListTrailingVisualProps
} from './Visuals'

/**
* Collection of list-related components.
Expand Down
6 changes: 3 additions & 3 deletions src/ActionMenu2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ const Menu: React.FC<ActionMenuProps> = ({
)
}

export type MenuAnchorProps = {children: React.ReactElement}
const Anchor = React.forwardRef<AnchoredOverlayProps['anchorRef'], MenuAnchorProps>(
export type ActionMenuAnchorProps = {children: React.ReactElement}
const Anchor = React.forwardRef<AnchoredOverlayProps['anchorRef'], ActionMenuAnchorProps>(
({children, ...anchorProps}, anchorRef) => {
return React.cloneElement(children, {...anchorProps, ref: anchorRef})
}
)

/** this component is syntactical sugar 🍭 */
export type MenuButtonProps = ButtonProps
export type ActionMenuButtonProps = ButtonProps
const MenuButton = React.forwardRef<AnchoredOverlayProps['anchorRef'], ButtonProps>((props, anchorRef) => {
return (
<Anchor ref={anchorRef}>
Expand Down