Merged in fix/puffs-map-in-map (pull request #23)
fix: move puffs map to own container Approved-by: Michael Zetterberg
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
import { Fragment } from "react"
|
import Puffs from "./Asides/Puffs"
|
||||||
|
|
||||||
import Puff from "./Asides/Puff"
|
|
||||||
|
|
||||||
import { AsideTypenameEnum } from "@/types/requests/utils/typename"
|
import { AsideTypenameEnum } from "@/types/requests/utils/typename"
|
||||||
import type { AsideProps } from "@/types/components/current/aside"
|
import type { AsideProps } from "@/types/components/current/aside"
|
||||||
@@ -18,13 +16,7 @@ export default function Aside({ blocks }: AsideProps) {
|
|||||||
case AsideTypenameEnum.CurrentBlocksPageAsideContact:
|
case AsideTypenameEnum.CurrentBlocksPageAsideContact:
|
||||||
return null
|
return null
|
||||||
case AsideTypenameEnum.CurrentBlocksPageAsidePuff:
|
case AsideTypenameEnum.CurrentBlocksPageAsidePuff:
|
||||||
return (
|
return <Puffs key={`block-${idx}`} puffs={block.puff.puffConnection.edges} />
|
||||||
<Fragment key={`puff-${idx}`}>
|
|
||||||
{block.puff.puffConnection.edges.map(puff => (
|
|
||||||
<Puff key={puff.node.system.uid} {...puff.node} />
|
|
||||||
))}
|
|
||||||
</Fragment>
|
|
||||||
)
|
|
||||||
default:
|
default:
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import styles from "./puff.module.css"
|
|||||||
import type { PuffProps } from "@/types/components/current/asides/puff"
|
import type { PuffProps } from "@/types/components/current/asides/puff"
|
||||||
import Image from "@/components/Image"
|
import Image from "@/components/Image"
|
||||||
|
|
||||||
export default function Puff({ imageConnection, is_internal, link, link_text, pageConnection, text, title }: PuffProps) {
|
export default function Puff({ imageConnection, is_internal, link, pageConnection, text, title }: PuffProps) {
|
||||||
if (is_internal) {
|
if (is_internal) {
|
||||||
const page = pageConnection.edges[0]
|
const page = pageConnection.edges[0]
|
||||||
if (!page?.node?.url) {
|
if (!page?.node?.url) {
|
||||||
16
components/Current/Asides/Puffs/index.tsx
Normal file
16
components/Current/Asides/Puffs/index.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import Puff from "./Puff"
|
||||||
|
|
||||||
|
import type { PuffsProps } from "@/types/components/current/asides/puffs"
|
||||||
|
|
||||||
|
export default function Puffs({ puffs }: PuffsProps) {
|
||||||
|
if (!puffs.length) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{puffs.map(puff => (
|
||||||
|
<Puff key={puff.node.system.uid} {...puff.node} />
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -14,7 +14,6 @@ fragment Puff on Puff {
|
|||||||
href
|
href
|
||||||
title
|
title
|
||||||
}
|
}
|
||||||
link_text
|
|
||||||
pageConnection {
|
pageConnection {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
|||||||
6
types/components/current/asides/puffs.ts
Normal file
6
types/components/current/asides/puffs.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import type { Node } from "@/types/requests/utils/edges"
|
||||||
|
import type { Puff } from "@/types/requests/puff"
|
||||||
|
|
||||||
|
export type PuffsProps = {
|
||||||
|
puffs: Node<Puff>[]
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@ export type Puff = {
|
|||||||
href: string
|
href: string
|
||||||
title: string
|
title: string
|
||||||
}
|
}
|
||||||
link_text?: string
|
|
||||||
pageConnection: Edges<PageLink>
|
pageConnection: Edges<PageLink>
|
||||||
system: {
|
system: {
|
||||||
uid: string
|
uid: string
|
||||||
|
|||||||
Reference in New Issue
Block a user