Skip to content

Commit

Permalink
Show underline on Link when hovered or focused. (#3586)
Browse files Browse the repository at this point in the history
* Show underline on Link when hovered or focused.

* Update snapshots.

* Add changeset.

* test(vrt): update snapshots

---------

Co-authored-by: radglob <radglob@users.noreply.github.com>
  • Loading branch information
radglob and radglob authored Aug 3, 2023
1 parent 87e4bf2 commit fbcb3b5
Show file tree
Hide file tree
Showing 42 changed files with 84 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .changeset/lemon-spoons-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/react': patch
---

Show underline on Link when hovered or focused.

<!-- Changed components: Link -->
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.
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.
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.
6 changes: 5 additions & 1 deletion src/Link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const StyledLink = styled.a<StyledLinkProps>`
color: ${props => (props.muted ? get('colors.fg.muted')(props) : get('colors.accent.fg')(props))};
text-decoration: ${props => (props.underline ? 'underline' : 'none')};
&:hover {
text-decoration: ${props => (props.muted ? 'none' : 'underline')};
text-decoration: underline;
${props => (props.hoverColor ? hoverColor : props.muted ? `color: ${get('colors.accent.fg')(props)}` : '')};
}
&:focus {
text-decoration: underline;
${props => (props.hoverColor ? hoverColor : props.muted ? `color: ${get('colors.accent.fg')(props)}` : '')};
}
&:is(button) {
Expand Down
41 changes: 37 additions & 4 deletions src/Link/__tests__/__snapshots__/Link.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ exports[`Link applies button styles when rendering a button element 1`] = `
text-decoration: underline;
}
.c0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c0:is(button) {
display: inline-block;
padding: 0;
Expand Down Expand Up @@ -46,6 +51,11 @@ exports[`Link passes href down to link element 1`] = `
text-decoration: underline;
}
.c0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c0:is(button) {
display: inline-block;
padding: 0;
Expand Down Expand Up @@ -81,6 +91,11 @@ exports[`Link renders consistently 1`] = `
text-decoration: underline;
}
.c0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c0:is(button) {
display: inline-block;
padding: 0;
Expand Down Expand Up @@ -116,6 +131,12 @@ exports[`Link respects hoverColor prop 1`] = `
color: #0969da;
}
.c0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
color: #0969da;
}
.c0:is(button) {
display: inline-block;
padding: 0;
Expand Down Expand Up @@ -147,8 +168,14 @@ exports[`Link respects the "sx" prop when "muted" prop is also passed 1`] = `
}
.c0:hover {
-webkit-text-decoration: none;
text-decoration: none;
-webkit-text-decoration: underline;
text-decoration: underline;
color: #0969da;
}
.c0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
color: #0969da;
}
Expand Down Expand Up @@ -183,8 +210,14 @@ exports[`Link respects the "muted" prop 1`] = `
}
.c0:hover {
-webkit-text-decoration: none;
text-decoration: none;
-webkit-text-decoration: underline;
text-decoration: underline;
color: #0969da;
}
.c0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
color: #0969da;
}
Expand Down
20 changes: 20 additions & 0 deletions src/NavList/__snapshots__/NavList.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ exports[`NavList renders a simple list 1`] = `
text-decoration: underline;
}
.c3:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c3:is(button) {
display: inline-block;
padding: 0;
Expand Down Expand Up @@ -604,6 +609,11 @@ exports[`NavList renders with groups 1`] = `
text-decoration: underline;
}
.c7:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c7:is(button) {
display: inline-block;
padding: 0;
Expand Down Expand Up @@ -1077,6 +1087,11 @@ exports[`NavList.Item with NavList.SubNav does not have active styles if SubNav
text-decoration: underline;
}
.c11:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c11:is(button) {
display: inline-block;
padding: 0;
Expand Down Expand Up @@ -1545,6 +1560,11 @@ exports[`NavList.Item with NavList.SubNav has active styles if SubNav contains t
text-decoration: underline;
}
.c11:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c11:is(button) {
display: inline-block;
padding: 0;
Expand Down
10 changes: 10 additions & 0 deletions src/UnderlineNav2/__snapshots__/UnderlineNav.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ exports[`UnderlineNav renders consistently 1`] = `
text-decoration: underline;
}
.c4:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c4:is(button) {
display: inline-block;
padding: 0;
Expand Down Expand Up @@ -207,6 +212,11 @@ exports[`UnderlineNav renders consistently 1`] = `
text-decoration: underline;
}
.c7:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c7:is(button) {
display: inline-block;
padding: 0;
Expand Down
5 changes: 5 additions & 0 deletions src/__tests__/__snapshots__/SideNav.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ exports[`SideNav SideNav.Link renders consistently 1`] = `
text-decoration: underline;
}
.c0:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.c0:is(button) {
display: inline-block;
padding: 0;
Expand Down

0 comments on commit fbcb3b5

Please sign in to comment.