Skip to content

Commit cbee0ae

Browse files
committed
fix(apps): use legacyBehavior for next-links used by RCHC-lib
TH-1427. Use a `legacyBehavior` for next/link used by RCHC-lib to get rid of double a-elements (a-element inside another), which broke the event info link styles by adding text decorations etc. It is also against the HTML-standard. See more about `legacyBehavior` from https://nextjs.org/docs/14/pages/api-reference/components/link#legacybehavior. The `legacyBehavior` for next/link is needed while the `<a>` is still injected in the Link component in react-helsinki-headless-cms -library. See https://github.com/City-of-Helsinki/react-helsinki-headless-cms/blob/ 130fafdabf8007143ae32f4866d8062c3e5afbcd/src/core/link/LinkBase.tsx#L229-L258.
1 parent 23c095b commit cbee0ae

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

apps/events-helsinki/src/hooks/useEventsRHHCConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default function useEventsRHHCConfig(args: {
7171
Head: (props: any) => <Head {...props} />,
7272
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7373
Link: ({ href, ...props }: any) => (
74-
<Link href={href || ''} {...props} />
74+
<Link legacyBehavior href={href || ''} {...props} />
7575
),
7676
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7777
EventCardContent: (props: any) => (

apps/hobbies-helsinki/src/hooks/useHobbiesRHHCConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default function useHobbiesRHHCConfig(args: {
6969
Head: (props: any) => <Head {...props} />,
7070
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7171
Link: ({ href, ...props }: any) => (
72-
<Link href={href || ''} {...props} />
72+
<Link legacyBehavior href={href || ''} {...props} />
7373
),
7474
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7575
EventCardContent: (props: any) => (

apps/sports-helsinki/src/hooks/useSportsRHHCConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default function useSportsRHHCConfig(args: {
6969
Head: (props: any) => <Head {...props} />,
7070
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7171
Link: ({ href, ...props }: any) => (
72-
<Link href={href || ''} {...props} />
72+
<Link legacyBehavior href={href || ''} {...props} />
7373
),
7474
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7575
EventCardContent: (props: any) => (

0 commit comments

Comments
 (0)