Skip to content

Commit

Permalink
fix(Anchor:) fixes anchor modifier .dnb-anchor--no-hover
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed Jul 28, 2023
1 parent 215e52c commit 715f800
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ To force a specific state of style, use the following classes to do so:

### Anchor with icons

Icons can be adde with the `icon` and `iconPosition` props. Normally by sending in the name if an icon, but it is also possible to send in html/react code (normally for custom svg).
Icons can be added with the `icon` and `iconPosition` props. Normally by sending in the name if an icon, but it is also possible to send in html/react code (normally for custom svg).

<AnchorExampleIcons />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ html[data-whatinput=keyboard] .dnb-anchor:focus {
box-shadow: 0 0 0 var(--border-width) var(--border-color);
border-color: transparent;
}
.dnb-anchor:hover, .dnb-anchor:active {
.dnb-anchor:hover :not(.dnb-anchor--no-hover), .dnb-anchor:active :not(.dnb-anchor--no-hover) {
border-radius: 0.25em;
}
.dnb-anchor:hover, .dnb-section .dnb-anchor:hover.dnb-anchor, .dnb-anchor:active, .dnb-section .dnb-anchor:active.dnb-anchor {
.dnb-anchor:hover :not(.dnb-anchor--no-hover), .dnb-section .dnb-anchor:hover :not(.dnb-anchor--no-hover).dnb-anchor, .dnb-anchor:active :not(.dnb-anchor--no-hover), .dnb-section .dnb-anchor:active :not(.dnb-anchor--no-hover).dnb-anchor {
text-decoration: none;
}
.dnb-anchor:active {
Expand Down Expand Up @@ -353,7 +353,6 @@ html[data-whatinput=keyboard] .dnb-anchor:focus {
text-decoration: none;
}
.dnb-anchor--no-style:hover {
color: inherit;
background-color: transparent;
}
Expand All @@ -362,7 +361,6 @@ html[data-whatinput=keyboard] .dnb-anchor:focus {
}
.dnb-anchor--no-hover:hover {
color: inherit;
background-color: transparent;
}
Expand Down Expand Up @@ -543,7 +541,7 @@ exports[`Anchor scss has to match theme css for ui 1`] = `
.dnb-anchor {
color: var(--color-sea-green);
}
.dnb-anchor:hover, .dnb-anchor:active {
.dnb-anchor:hover :not(.dnb-anchor--no-hover), .dnb-anchor:active :not(.dnb-anchor--no-hover) {
color: var(--color-sea-green);
box-shadow: inset 100vw 100vw 0 0 var(--color-mint-green-50), -0.125em 0 0 0 var(--color-mint-green-50), 0.125em 0 0 0 var(--color-mint-green-50);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@

@mixin resetAnchorHoverStyle() {
&:hover {
color: inherit;

// in case we don't want to change the color to the body color
background-color: transparent;
}
Expand Down Expand Up @@ -187,7 +185,9 @@

&:hover,
&:active {
@include anchorHoverStyle();
:not(.dnb-anchor--no-hover) {
@include anchorHoverStyle();
}
}

&:active {
Expand All @@ -207,7 +207,6 @@
[data-visual-test-wrapper] & {
transition: none;
}

// other stuff, not related to the Anchor directly
.dnb-icon {
display: inline-block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

&:hover,
&:active {
color: var(--color-sea-green);
@include anchor-mixins.anchorBackground(var(--color-mint-green-50));
:not(.dnb-anchor--no-hover) {
color: var(--color-sea-green);
@include anchor-mixins.anchorBackground(var(--color-mint-green-50));
}
}

&:active {
Expand Down

0 comments on commit 715f800

Please sign in to comment.