Skip to content

Commit 27d13b6

Browse files
🐛 add missing locale from spread (#3468)
1 parent 68fe222 commit 27d13b6

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

web/core/Link/BaseLink.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { AnchorHTMLAttributes, forwardRef } from 'react'
2-
import NextLink, { LinkProps } from 'next/link'
1+
import NextLink, { type LinkProps } from 'next/link'
2+
import { type AnchorHTMLAttributes, forwardRef } from 'react'
33
import { twMerge } from 'tailwind-merge'
4-
import { LinkType } from '../../types/index'
4+
import type { LinkType } from '../../types/index'
55

66
export type BaseLinkProps = {
77
/** What kind of content is it */
@@ -18,7 +18,7 @@ export type BaseLinkProps = {
1818
* And the strict origin policy when external for using blank
1919
*/
2020
export const BaseLink = forwardRef<HTMLAnchorElement, BaseLinkProps>(function BaseLink(
21-
{ children, type = 'internalUrl', className = '', href = '', skipInternalStyle = false, ...rest },
21+
{ children, type = 'internalUrl', className = '', href = '', skipInternalStyle = false, locale },
2222
ref,
2323
) {
2424
const classNames = skipInternalStyle
@@ -50,7 +50,6 @@ export const BaseLink = forwardRef<HTMLAnchorElement, BaseLinkProps>(function Ba
5050
ref={ref}
5151
href={href}
5252
target="_blank"
53-
{...rest}
5453
rel="noopener"
5554
referrerPolicy="strict-origin-when-cross-origin"
5655
>
@@ -59,14 +58,14 @@ export const BaseLink = forwardRef<HTMLAnchorElement, BaseLinkProps>(function Ba
5958
)
6059
case 'icsLink':
6160
return (
62-
<a className={classNames} ref={ref} href={href} {...rest}>
61+
<a className={classNames} ref={ref} href={href}>
6362
{children}
6463
</a>
6564
)
6665

6766
default:
6867
return (
69-
<NextLink {...rest} ref={ref} href={href} prefetch={false} className={classNames}>
68+
<NextLink ref={ref} href={href} locale={locale} prefetch={false} className={classNames}>
7069
{children}
7170
</NextLink>
7271
)

web/core/Link/ResourceLink.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { add, calendar } from '@equinor/eds-icons'
22
import { forwardRef } from 'react'
3-
import { useIntl } from 'react-intl'
43
import { ArrowRight } from '../../icons'
54
import { TransformableIcon } from '../../icons/TransformableIcon'
65
import envisTwMerge from '../../twMerge'
@@ -100,6 +99,7 @@ export const ResourceLink = forwardRef<HTMLAnchorElement, ResourceLinkProps>(fun
10099
href = '',
101100
isAttachment = false,
102101
file,
102+
locale,
103103
},
104104
ref,
105105
) {
@@ -143,9 +143,7 @@ export const ResourceLink = forwardRef<HTMLAnchorElement, ResourceLinkProps>(fun
143143
? `underline
144144
hover:text-norwegian-woods-100
145145
dark:hover:text-slate-blue-95`
146-
: `border-b
147-
border-grey-50
148-
dark:border-white-100 no-underline`
146+
: `border-b border-grey-50 dark:border-white-100 no-underline`
149147
}
150148
${variantClassName[variant]}
151149
`,
@@ -184,7 +182,7 @@ export const ResourceLink = forwardRef<HTMLAnchorElement, ResourceLinkProps>(fun
184182
}
185183

186184
return href ? (
187-
<BaseLink className={classNames} type={type} ref={ref} href={href}>
185+
<BaseLink className={classNames} type={type} ref={ref} href={href} locale={locale}>
188186
<span
189187
className={envisTwMerge(
190188
`h-full

web/lib/localization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { languages, defaultLanguage } from '../languages'
1+
import { defaultLanguage, languages } from '../languages'
22

33
export const getNameFromLocale = (locale: string | undefined): string => {
44
return languages.find((lang) => lang.locale === locale)?.name || defaultLanguage.name

web/sections/CallToActions/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const CallToActions = ({ callToActions = [], splitList, className }: CallToActio
5252
{callToActions.map((callToAction: LinkData) => {
5353
const url = getUrlFromAction(callToAction)
5454
const { id, label, type, link, file } = callToAction
55+
5556
return url ? (
5657
<li key={id}>
5758
{/* If the URL is a static AEM page it should behave as an internal link in the web */}

0 commit comments

Comments
 (0)