fix: correct Shortcuts

This commit is contained in:
Arvid Norlin
2024-04-24 16:15:46 +02:00
parent dd2127749a
commit 03daf0540e
5 changed files with 23 additions and 8 deletions

View File

@@ -66,9 +66,13 @@ export default function Content({ user, lang, content }: ContentProps) {
/>
)
case ContentEntries.AccountPageContentShortcuts:
const shortcuts = item.shortcuts.shortcuts.map(
(shortcut) => shortcut.linkConnection.edges[0].node
)
const shortcuts = item.shortcuts.shortcuts.map((shortcut) => {
return {
text: shortcut.text,
openInNewTab: shortcut.open_in_new_tab,
...shortcut.linkConnection.edges[0].node,
}
})
return (
<Shortcuts
shortcuts={shortcuts}

View File

@@ -26,8 +26,9 @@ export default function Shortcuts({
className={styles.link}
href={shortcut.url}
key={shortcut.title}
target={shortcut.openInNewTab ? "_blank" : undefined}
>
<span>{shortcut.title}</span>
<span>{shortcut.text ? shortcut.text : shortcut.title}</span>
<Image
alt="Chevron Icon"
height={20}

View File

@@ -7,6 +7,8 @@ fragment AccountPageContentShortcuts on AccountPageContentShortcuts {
title
preamble
shortcuts {
text
open_in_new_tab
linkConnection {
edges {
node {

View File

@@ -1,7 +1,13 @@
import { ReactNode } from "react"
export type ShortcutsProps = {
shortcuts: { url: string; title: string }[]
shortcuts: {
url: string
title: string
openInNewTab?: boolean
text?: string
}[]
title: string | ReactNode
subtitle?: string
openInNewTab?: boolean
}

View File

@@ -1,8 +1,9 @@
import { AllRequestResponse } from "../utils/all"
import type { Typename } from "../utils/typename"
import type { Edges } from "../utils/edges"
import { PageLink } from "../utils/pageLink"
import { RTEDocument } from "@/types/rte/node"
import type { Edges } from "../utils/edges"
import type { Typename } from "../utils/typename"
export enum DynamicContentComponents {
membership_overview = "membership_overview",
@@ -20,8 +21,9 @@ export enum ContentEntries {
}
type Shortcut = {
text: string
linkConnection: Edges<PageLink>
open_in_new_tab: boolean
text: string
}
type DynamicContent = {