fix: cleanup

This commit is contained in:
Christel Westerberg
2024-02-13 16:06:37 +01:00
parent 4b193541b2
commit 367dffc41d
7 changed files with 21 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
import { previewRequest } from "@/lib/previewRequest"
import { GetCurrentBlockPage } from "@/lib/graphql/Query/CurrentBlockPage.graphql"
import type { PageArgs, LangParams, UriParams } from "@/types/params"
import type { PageArgs, LangParams, PreviewParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
import ContentstackLivePreview from "@contentstack/live-preview-utils"
import LoadingSpinner from "@/components/Current/LoadingSpinner"
@@ -10,11 +10,11 @@ import ContentPage from "@/components/Current/ContentPage"
export default async function CurrentContentPage({
params,
searchParams,
}: PageArgs<LangParams, UriParams>) {
}: PageArgs<LangParams, PreviewParams>) {
try {
ContentstackLivePreview.setConfigFromParams(searchParams)
if (!searchParams.uri || !searchParams["live_preview"]) {
if (!searchParams.uri || !searchParams.live_preview) {
return <LoadingSpinner />
}

View File

@@ -1,6 +1,5 @@
.highlightBlock {
background: #fff;
padding: 10px 10px 15px;
background: #fff;
overflow: hidden;

View File

@@ -17,7 +17,12 @@ export default function Aside({ blocks }: AsideProps) {
const type = block.__typename
switch (type) {
case AsideTypenameEnum.CurrentBlocksPageAsideContact:
return <Contacts contacts={block.contact.contactConnection.edges} />
return (
<Contacts
contacts={block.contact.contactConnection.edges}
key={`block-${idx}`}
/>
)
case AsideTypenameEnum.CurrentBlocksPageAsidePuff:
return (
<Puffs

View File

@@ -10,7 +10,6 @@
}
.heroImage {
object-fit: contain;
width: 100%;
height: auto;
max-height: 600px;

View File

@@ -7,18 +7,17 @@ import type { HeroProps } from "@/types/components/current/hero"
export default function Hero({ images }: HeroProps) {
return (
<div className={styles.wrapper} aria-label="Hero" tabIndex={0}>
<picture className={styles.picture}>
{images.map(({ node: image }) => (
{images.map(({ node: image }) => (
<picture className={styles.picture} key={image.title}>
<Image
alt={image.title}
className={styles.heroImage}
height={image.dimension.height}
key={image.title}
src={image.url}
width={image.dimension.width}
/>
))}
</picture>
</picture>
))}
</div>
)
}

View File

@@ -3,7 +3,7 @@
gap: 60px;
margin: 0 auto;
max-width: 1200px;
padding: 20px 10px 5px;
padding: 20px 10px 25px;
background: #fff;
}
@@ -13,14 +13,14 @@
font-size: 1.25rem;
font-weight: 300;
line-height: normal;
margin-bottom: 20px;
text-transform: none;
margin-bottom: 0;
}
@media (min-width: 740px){
.container {
background: transparent;
padding: 20px 30px 15px;
padding: 20px 30px 35px;
grid-template-columns: 2fr 1fr;
}
}

View File

@@ -16,6 +16,11 @@ export type UriParams = {
uri?: string;
};
export type PreviewParams = {
uri?: string
live_preview?: string
}
export type LayoutArgs<P = undefined> = P extends undefined ? {} : Params<P>;
export type PageArgs<P = undefined, S = undefined> = LayoutArgs<P> &