= ({ boolValues }) => {
- const active = boolValues?.["active"];
- const back = boolValues?.["back"];
+ const active = boolValues?.["Aktiv"];
+ const back = boolValues?.["Tilbakelenke"];
return (
diff --git a/packages/jokul/src/components/link/integration/link.spec.ts b/packages/jokul/src/components/link/integration/link.spec.ts
index e6a279bb10b..30f94dad3b3 100644
--- a/packages/jokul/src/components/link/integration/link.spec.ts
+++ b/packages/jokul/src/components/link/integration/link.spec.ts
@@ -21,3 +21,11 @@ test("renders correctly", async () => {
await helper.snapshots({ focusElement: ".jkl-link" });
});
+
+test("renders external link correctly", async () => {
+ await helper.open();
+
+ await helper.checkProp("bool-prop-ekstern");
+
+ await helper.snapshots();
+});
diff --git a/packages/jokul/src/components/link/styles/link.scss b/packages/jokul/src/components/link/styles/link.scss
index ffe74ab688e..470b21c1173 100644
--- a/packages/jokul/src/components/link/styles/link.scss
+++ b/packages/jokul/src/components/link/styles/link.scss
@@ -4,16 +4,18 @@
background-image: linear-gradient(to bottom, $color 0%, $color 100%);
}
-$_right-arrow: "\2192"; // unicode right arrow
-$_left-arrow: "\2190"; // unicode left arrow
-$_north-east-arrow: "\2197"; // unicode north east arrow (up/right)
-
$_link-underline-thickness: jkl.rem(1px);
$_link-underline-thickness--focus: jkl.rem(2px);
.jkl-link {
color: var(--jkl-color-text-default);
- @include _underline-gradient(var(--jkl-color-text-default));
+ outline: none;
+ text-decoration: none;
+
+ display: inline-flex;
+ align-items: center;
+ gap: jkl.rem(1.5px);
+
background-position: 0
calc(
100% -
@@ -23,10 +25,11 @@ $_link-underline-thickness--focus: jkl.rem(2px);
);
background-size: $_link-underline-thickness $_link-underline-thickness;
background-repeat: repeat-x;
- @include jkl.motion("standard", "energetic");
+
transition-property: color;
- outline: none;
- text-decoration: none;
+ @include jkl.motion("standard", "energetic");
+
+ @include _underline-gradient(var(--jkl-color-text-default));
&:hover:not(:focus) {
color: var(--jkl-color-text-subdued);
@@ -51,15 +54,6 @@ $_link-underline-thickness--focus: jkl.rem(2px);
);
}
- /* Show arrow after external links, or links opening
- in a new window or tab: */
- &[target="_blank"],
- &--external {
- &::after {
- @include jkl.decorative($content: $_north-east-arrow);
- }
- }
-
@include jkl.forced-colors-mode {
outline: revert;
text-decoration: revert;
diff --git a/packages/jokul/src/components/link/styles/nav-link.scss b/packages/jokul/src/components/link/styles/nav-link.scss
index 67fa8f5c90b..f12493dcd7f 100644
--- a/packages/jokul/src/components/link/styles/nav-link.scss
+++ b/packages/jokul/src/components/link/styles/nav-link.scss
@@ -1,8 +1,5 @@
@use "../../../core/jkl";
-$_right-arrow: "\2192"; // unicode right arrow
-$_left-arrow: "\2190"; // unicode left arrow
-
.jkl-nav-link {
color: var(--jkl-color-text-default);
@@ -11,65 +8,53 @@ $_left-arrow: "\2190"; // unicode left arrow
text-decoration: none;
position: relative;
- @include jkl.reset-outline;
+ display: inline-flex;
+ align-items: center;
+ gap: jkl.rem(1.5px);
- &::after {
- @include jkl.decorative($content: $_right-arrow);
- @include jkl.motion;
- transition-property: padding-left, padding-right;
- display: inline;
- margin-left: -0.2em;
- padding-left: 0.35em;
- padding-right: 0.35em;
- }
+ @include jkl.reset-outline;
&:hover:not(:focus) {
color: var(--jkl-color-text-subdued);
-
- &::after {
- padding-left: 0.7em;
- padding-right: 0;
- }
}
&:focus-visible {
@include jkl.focus-outline($offset: 0);
-
- &::after {
- padding-left: 0.7em;
- padding-right: 0;
- }
}
- &--active {
- @include jkl.no-grow-bold;
- }
-}
-
-.jkl-nav-link--back {
- padding-right: 0;
-
- $left-arrow-focus-margin: 0.3em; // Unngå at border ved tastaturfokus "kapper" pila
- padding-left: $left-arrow-focus-margin;
- margin-left: -#{$left-arrow-focus-margin};
-
- &::after {
- display: none;
+ &:focus-visible,
+ &:hover:not(:focus) {
+ .jkl-nav-link__icon {
+ transform: translateX(0.3rem);
+ }
}
- &::before {
- @include jkl.decorative($content: $_left-arrow);
+ &__icon {
@include jkl.motion;
- transform: translateX(0);
transition-property: transform;
- display: inline-block;
- padding-right: jkl.rem(4px);
}
- &:hover,
- &:focus-visible {
- &::before {
- transform: translateX(-33%);
+ &--active {
+ @include jkl.no-grow-bold;
+ }
+
+ // Unngå at border ved tastaturfokus "kapper" pila
+ $arrow-spacing: 0.15rem;
+ padding-right: $arrow-spacing;
+ margin-right: -#{$arrow-spacing};
+
+ &--back {
+ padding-right: 0;
+ margin-right: 0;
+ padding-left: $arrow-spacing;
+ margin-left: -#{$arrow-spacing};
+
+ &:focus-visible,
+ &:hover:not(:focus) {
+ .jkl-nav-link__icon {
+ padding-left: 0;
+ transform: translateX(-0.3rem);
+ }
}
}
}