Skip to content

Commit

Permalink
Add trailingVisual alias to ActionList/ActionMenu (#1521)
Browse files Browse the repository at this point in the history
* add trailingVisual alias to ActionList/ActionMenu

* replace both icon and text with visual

* Create gold-ads-kneel.md

* Update .changeset/gold-ads-kneel.md

Co-authored-by: Cole Bemis <colebemis@github.com>

* Change type for trailingVisual to ReactNode

* docs: Add trailingVisual to ActionList example

Co-authored-by: Cole Bemis <colebemis@github.com>
  • Loading branch information
siddharthkp and colebemis committed Oct 25, 2021
1 parent dcf693f commit 28b5980
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-ads-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/components": patch
---

Add `trailingVisual` prop to ActionList/ActionMenu. Deprecate `trailingIcon` and `trailingText` props.
4 changes: 2 additions & 2 deletions docs/content/ActionList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ An `ActionList` is a list of items which can be activated or selected. `ActionLi
{groupId: '4'}
]}
items={[
{key: '1', leadingVisual: TypographyIcon, text: 'Rename', groupId: '0'},
{key: '1', leadingVisual: TypographyIcon, text: 'Rename', groupId: '0', trailingVisual: '⌘R'},
{key: '2', leadingVisual: VersionsIcon, text: 'Duplicate', groupId: '0'},
{key: '3', leadingVisual: SearchIcon, text: 'repo:github/github', groupId: '1'},
{
Expand All @@ -59,7 +59,7 @@ An `ActionList` is a list of items which can be activated or selected. `ActionLi
groupId: '3'
},
{key: '7', leadingVisual: FilterIcon, text: 'Save sort and filters to new view', groupId: '3'},
{key: '8', leadingVisual: GearIcon, text: 'View settings', groupId: '4'}
{key: '8', leadingVisual: GearIcon, text: 'View settings', groupId: '4', trailingVisual: ArrowRightIcon}
]}
/>
```
Expand Down
4 changes: 3 additions & 1 deletion docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
FilterIcon,
GearIcon,
TypographyIcon,
VersionsIcon
VersionsIcon,
ArrowRightIcon
} from '@primer/octicons-react'
import State from '../../../components/State'
import {Dialog as Dialog2} from '../../../../src/Dialog/Dialog'
Expand Down Expand Up @@ -46,6 +47,7 @@ export default {
GearIcon,
TypographyIcon,
VersionsIcon,
ArrowRightIcon,
Dialog2,
ConfirmationDialog,
useConfirm,
Expand Down
2 changes: 1 addition & 1 deletion src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export interface ItemProps extends SxProp {
/**
* Icon or text positioned after `Item` text.
*/
trailingVisual?: React.FunctionComponent<IconProps> | string
trailingVisual?: React.ReactNode

/**
* Style variations associated with various `Item` types.
Expand Down
2 changes: 1 addition & 1 deletion src/stories/ActionMenu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export function ExternalOpenState(): JSX.Element {
{
text: 'Delete file',
variant: 'danger',
trailingText: '⌘D'
trailingVisual: '⌘D'
}
]}
/>
Expand Down

0 comments on commit 28b5980

Please sign in to comment.