Skip to content

Commit a9ae333

Browse files
committed
fix(Link): Do not pass through hoverColor prop in Link
1 parent 1d4116d commit a9ae333

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": minor
3+
---
4+
5+
Do not pass through hoverColor prop into DOM element

packages/react/src/Link/Link.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type StyledLinkProps = {
1717
inline?: boolean
1818
} & SxProp
1919

20-
const Link = forwardRef(({as: Component = 'a', className, inline, underline, ...props}, forwardedRef) => {
20+
const Link = forwardRef(({as: Component = 'a', className, inline, underline, hoverColor, ...props}, forwardedRef) => {
2121
const innerRef = React.useRef<HTMLAnchorElement>(null)
2222
useRefObjectAsForwardedRef(forwardedRef, innerRef)
2323

@@ -53,6 +53,7 @@ const Link = forwardRef(({as: Component = 'a', className, inline, underline, ...
5353
data-muted={props.muted}
5454
data-inline={inline}
5555
data-underline={underline}
56+
data-hover-color={hoverColor}
5657
{...props}
5758
// @ts-ignore shh
5859
ref={innerRef}
@@ -66,6 +67,7 @@ const Link = forwardRef(({as: Component = 'a', className, inline, underline, ...
6667
data-muted={props.muted}
6768
data-inline={inline}
6869
data-underline={underline}
70+
data-hover-color={hoverColor}
6971
{...props}
7072
// @ts-ignore shh
7173
ref={innerRef}

packages/react/src/Link/__tests__/__snapshots__/Link.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports[`Link passes href down to link element 1`] = `
1616
exports[`Link respects hoverColor prop 1`] = `
1717
<a
1818
className="Link"
19-
hoverColor="accent.fg"
19+
data-hover-color="accent.fg"
2020
/>
2121
`;
2222

0 commit comments

Comments
 (0)