-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
256 additions
and
9 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,5 @@ | ||
--- | ||
"@primer/react": minor | ||
--- | ||
|
||
Introduce ActionList.TrailingAction to support secondary action on ActionList.Item |
Binary file modified
BIN
+0 Bytes
(100%)
...ist.test.ts-snapshots/ActionList-Inactive-Multiselect-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...ionList.test.ts-snapshots/ActionList-Inactive-Multiselect-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1 Byte
(100%)
....test.ts-snapshots/ActionList-Inactive-Multiselect-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...nts/ActionList.test.ts-snapshots/ActionList-Inactive-Multiselect-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
...ist.test.ts-snapshots/ActionList-Inactive-Multiselect-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
...st.test.ts-snapshots/ActionList-Inactive-Multiselect-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+11 Bytes
(100%)
...test.ts-snapshots/ActionList-Inactive-Multiselect-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9 Bytes
(100%)
...ts/ActionList.test.ts-snapshots/ActionList-Inactive-Multiselect-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
...st.test.ts-snapshots/ActionList-Inactive-Multiselect-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.8 KB
...ist.test.ts-snapshots/ActionList-With-Trailing-Action-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.2 KB
...ionList.test.ts-snapshots/ActionList-With-Trailing-Action-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.5 KB
....test.ts-snapshots/ActionList-With-Trailing-Action-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.8 KB
...nts/ActionList.test.ts-snapshots/ActionList-With-Trailing-Action-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.8 KB
...ist.test.ts-snapshots/ActionList-With-Trailing-Action-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.1 KB
...st.test.ts-snapshots/ActionList-With-Trailing-Action-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.1 KB
...test.ts-snapshots/ActionList-With-Trailing-Action-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.1 KB
...ts/ActionList.test.ts-snapshots/ActionList-With-Trailing-Action-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.1 KB
...st.test.ts-snapshots/ActionList-With-Trailing-Action-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-61 Bytes
(100%)
...shots/components/Avatar.test.ts-snapshots/Avatar-Size-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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,55 @@ | ||
import React, {forwardRef} from 'react' | ||
import Box from '../Box' | ||
import {Button, IconButton} from '../Button' | ||
import type {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic' | ||
|
||
export type ActionListTrailingActionProps = { | ||
as?: 'button' | 'a' | ||
href?: string | ||
icon?: React.ElementType | ||
label: string | ||
} | ||
|
||
export const TrailingAction = forwardRef(({as = 'button', icon, label, href = null, ...props}, forwardedRef) => { | ||
if (!icon) { | ||
return ( | ||
<Box | ||
data-component="ActionList.TrailingAction" | ||
as="span" | ||
sx={{ | ||
flexShrink: 0, | ||
}} | ||
> | ||
{/* @ts-expect-error TODO: Fix this */} | ||
<Button variant="invisible" as={as} href={href} ref={forwardedRef} {...props}> | ||
{label} | ||
</Button> | ||
</Box> | ||
) | ||
} else { | ||
return ( | ||
<Box | ||
as="span" | ||
data-component="ActionList.TrailingAction" | ||
sx={{ | ||
flexShrink: 0, | ||
}} | ||
> | ||
<IconButton | ||
as={as} | ||
aria-label={label} | ||
icon={icon} | ||
variant="invisible" | ||
unsafeDisableTooltip={false} | ||
tooltipDirection="w" | ||
href={href} | ||
// @ts-expect-error StyledButton wants both Anchor and Button refs | ||
ref={forwardedRef} | ||
{...props} | ||
/> | ||
</Box> | ||
) | ||
} | ||
}) as PolymorphicForwardRefComponent<'button' | 'a', ActionListTrailingActionProps> | ||
|
||
TrailingAction.displayName = 'ActionList.TrailingAction' |
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.