Skip to content
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
7 changes: 7 additions & 0 deletions .changeset/cyan-cycles-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@primer/react": patch
---

ActionList: Fix icon and description hover colors for danger variant

<!-- Changed components: ActionList -->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions src/ActionList/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,30 @@ export const Description: React.FC<React.PropsWithChildren<ActionListDescription
flexBasis: 0,
minWidth: 0,
marginLeft: variant === 'block' ? 0 : 2,
color: 'fg.muted',
'li[aria-disabled="true"] &': {
color: 'inherit',
},
'li[data-variant="danger"]:hover &, li[data-variant="danger"]:active &': {
color: 'inherit',
},
}

const {blockDescriptionId, inlineDescriptionId, disabled} = React.useContext(ItemContext)
const {blockDescriptionId, inlineDescriptionId} = React.useContext(ItemContext)

return variant === 'block' ? (
<Box
as="span"
sx={merge({...styles, color: disabled ? 'fg.disabled' : 'fg.muted'}, sx as SxProp)}
// huh why?
sx={merge(styles, sx as SxProp)}
id={blockDescriptionId}
>
{props.children}
</Box>
) : (
<Truncate
id={inlineDescriptionId}
sx={merge({...styles, color: disabled ? 'fg.disabled' : 'fg.muted'}, sx as SxProp)}
sx={merge(styles, sx as SxProp)}
title={props.children as string}
inline={true}
maxWidth="100%"
Expand Down
8 changes: 7 additions & 1 deletion src/ActionList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,13 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(

return (
<ItemContext.Provider value={{variant, disabled, inlineDescriptionId, blockDescriptionId}}>
<LiBox ref={forwardedRef} sx={merge<BetterSystemStyleObject>(styles, sxProp)} {...containerProps} {...props}>
<LiBox
ref={forwardedRef}
sx={merge<BetterSystemStyleObject>(styles, sxProp)}
data-variant={variant === 'danger' ? variant : undefined}
{...containerProps}
{...props}
>
<ItemWrapper {...wrapperProps}>
<Selection selected={selected} />
{slots.leadingVisual}
Expand Down
6 changes: 6 additions & 0 deletions src/ActionList/Visuals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export const LeadingVisual: React.FC<React.PropsWithChildren<VisualProps>> = ({s
{
color: getVariantStyles(variant, disabled).iconColor,
svg: {fontSize: 0},
'[data-variant="danger"]:hover &, [data-variant="danger"]:active &': {
color: getVariantStyles(variant, disabled).hoverColor,
},
},
sx as SxProp,
)}
Expand All @@ -60,6 +63,9 @@ export const TrailingVisual: React.FC<React.PropsWithChildren<VisualProps>> = ({
color: getVariantStyles(variant, disabled).annotationColor,
marginLeft: 2,
fontWeight: 'initial',
'[data-variant="danger"]:hover &, [data-variant="danger"]:active &': {
color: getVariantStyles(variant, disabled).hoverColor,
},
},
sx as SxProp,
)}
Expand Down
10 changes: 10 additions & 0 deletions src/NavList/__snapshots__/NavList.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,11 @@ exports[`NavList.Item with NavList.SubNav does not have active styles if SubNav
font-weight: initial;
}

[data-variant="danger"]:hover .c7,
[data-variant="danger"]:active .c7 {
color: #1F2328;
}

.c8 {
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
Expand Down Expand Up @@ -1290,6 +1295,11 @@ exports[`NavList.Item with NavList.SubNav has active styles if SubNav contains t
font-weight: initial;
}

[data-variant="danger"]:hover .c7,
[data-variant="danger"]:active .c7 {
color: #1F2328;
}

.c8 {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
Expand Down