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 Sep 15, 2023
1 parent 42822c2 commit 3ecae36
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 32 deletions.
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.
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ sup .dnb-anchor, sub .dnb-anchor {
.dnb-anchor:focus-visible, .dnb-section .dnb-anchor:focus-visible.dnb-anchor {
text-decoration: none;
}
.dnb-anchor:hover {
.dnb-anchor:hover:not(.dnb-anchor--no-hover), .dnb-anchor:hover:not(.dnb-anchor--no-style) {
border-radius: 0.25em;
}
.dnb-anchor:hover, .dnb-section .dnb-anchor:hover.dnb-anchor {
.dnb-anchor:hover:not(.dnb-anchor--no-hover), .dnb-section .dnb-anchor:hover:not(.dnb-anchor--no-hover).dnb-anchor, .dnb-anchor:hover:not(.dnb-anchor--no-style), .dnb-section .dnb-anchor:hover:not(.dnb-anchor--no-style).dnb-anchor {
text-decoration: none;
}
.dnb-anchor:active {
Expand Down Expand Up @@ -323,7 +323,7 @@ sup .dnb-anchor, sub .dnb-anchor {
.dnb-anchor.dnb-anchor--contrast {
color: var(--color-white);
}
.dnb-anchor.dnb-anchor--contrast:hover {
.dnb-anchor.dnb-anchor--contrast:hover:not(.dnb-anchor--no-hover), .dnb-anchor.dnb-anchor--contrast:hover:not(.dnb-anchor--no-style) {
color: var(--anchor-color--contrast);
box-shadow: inset 100vw 100vw 0 0 var(--color-white), -0.125em 0 0 0 var(--color-white), 0.125em 0 0 0 var(--color-white);
}
Expand Down Expand Up @@ -377,20 +377,11 @@ sup .dnb-anchor, sub .dnb-anchor {
.dnb-anchor--no-style, .dnb-section .dnb-anchor--no-style.dnb-anchor {
text-decoration: none;
}
.dnb-anchor--no-style:hover {
color: inherit;
background-color: transparent;
}
.dnb-anchor--no-underline, .dnb-section .dnb-anchor--no-underline.dnb-anchor {
text-decoration: none;
}
.dnb-anchor--no-hover:hover {
color: inherit;
background-color: transparent;
}
.dnb-anchor--no-radius, .dnb-anchor--no-radius:hover, .dnb-anchor--no-radius:active, .dnb-anchor--no-radius:focus-visible {
border-radius: 0;
}
Expand Down Expand Up @@ -440,7 +431,7 @@ exports[`Anchor scss has to match theme css for sbanken 1`] = `
.dnb-anchor--no-underline, .dnb-anchor--has-icon, .dnb-anchor--inline {
box-shadow: inset 100vw 100vw 0 0 var(--anchor-background), -0.25em 0 0 0 var(--anchor-background), 0.25em 0 0 0 var(--anchor-background);
}
.dnb-anchor:hover {
.dnb-anchor:hover:not(.dnb-anchor--no-hover), .dnb-anchor:hover:not(.dnb-anchor--no-style) {
--anchor-background: var(--sb-color-green-dark);
color: var(--sb-color-text);
transition: none;
Expand Down Expand Up @@ -580,7 +571,7 @@ exports[`Anchor scss has to match theme css for ui 1`] = `
--anchor-background--active: var(--color-emerald-green);
color: var(--anchor-color);
}
.dnb-anchor:hover {
.dnb-anchor:hover:not(.dnb-anchor--no-hover), .dnb-anchor:hover:not(.dnb-anchor--no-style) {
--anchor-color: var(--color-sea-green);
box-shadow: inset 100vw 100vw 0 0 var(--anchor-background--hover), -0.125em 0 0 0 var(--anchor-background--hover), 0.125em 0 0 0 var(--anchor-background--hover);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@
}
}

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

// in case we don't want to change the color to the body color
background-color: transparent;
}
}

@mixin resetAnimationStyle() {
transition: none;
}
Expand Down Expand Up @@ -106,7 +97,8 @@
@mixin useAnchorContrastStyle {
color: var(--color-white);

&:hover {
&:hover:not(.dnb-anchor--no-hover),
&:hover:not(.dnb-anchor--no-style) {
color: var(--anchor-color--contrast);
@include anchorBackground(var(--color-white));
}
Expand Down Expand Up @@ -176,7 +168,8 @@
@include anchorFocusStyle();
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,13 @@ button.dnb-anchor {
color: inherit;

@include resetUnderlineStyle();
@include resetAnchorHoverStyle();
@include resetAnimationStyle();
}

.dnb-anchor--no-underline {
@include resetUnderlineStyle();
}

.dnb-anchor--no-hover {
@include resetAnchorHoverStyle();
}

.dnb-anchor--no-radius {
@include resetBorderRadius();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
);
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

color: var(--anchor-color);

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

Expand Down

0 comments on commit 3ecae36

Please sign in to comment.