-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aaec780
commit 63d1067
Showing
11 changed files
with
18,666 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { HeadingField } from "@/fields/heading"; | ||
import type { Block } from "payload"; | ||
|
||
export const ContentGrid: Block = { | ||
slug: "contentGrid", | ||
interfaceName: "ContentGridBlock", | ||
fields: [ | ||
{ | ||
type: "row", | ||
fields: [ | ||
{ | ||
name: "variant", | ||
type: "select", | ||
defaultValue: "sideBySide", | ||
enumName: "enum_content_grid_variant", | ||
label: { | ||
en: "Variant", | ||
de: "Variante", | ||
}, | ||
options: [ | ||
{ | ||
label: "Side by Side", | ||
value: "sideBySide", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
HeadingField(), | ||
{ | ||
name: "content", | ||
type: "richText", | ||
required: true, | ||
localized: true, | ||
}, | ||
{ | ||
name: "cells", | ||
type: "array", | ||
fields: [ | ||
{ | ||
name: "heading", | ||
type: "text", | ||
required: true, | ||
localized: true, | ||
}, | ||
{ | ||
name: "description", | ||
type: "textarea", | ||
required: false, | ||
localized: true, | ||
}, | ||
], | ||
minRows: 1, | ||
maxRows: 8, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { RichText } from "@/components/cms/rich-text"; | ||
import { Heading, Paragraph } from "@/components/ui/typography"; | ||
import { HeadingVariants } from "@/components/ui/typography/heading"; | ||
import type { ContentGridBlock as ContentGridBlockProps } from "@/payload-types"; | ||
|
||
type Props = ContentGridBlockProps; | ||
|
||
export const ContentGridBlock = ({ | ||
content, | ||
cells, | ||
heading, | ||
headingLevel, | ||
headingTag, | ||
}: Props) => { | ||
return ( | ||
<div className="layout pt-xhuge"> | ||
<div className="col-span-full lg:col-span-4 space-y-4"> | ||
<Heading | ||
as={headingTag} | ||
level={ | ||
(headingLevel | ||
? (Number.parseInt(headingLevel) ?? 3) | ||
: 3) as HeadingVariants["level"] | ||
} | ||
> | ||
{heading} | ||
</Heading> | ||
{content && <RichText size="lg" content={content} />} | ||
</div> | ||
<div className="col-span-full lg:col-span-8"> | ||
<div className="layout"> | ||
{cells?.map((cell) => ( | ||
<div | ||
key={`${cell.id}`} | ||
className="col-span-full lg:col-span-6 w-full @container space-y-2" | ||
> | ||
{cell.heading && ( | ||
<Heading as="h4" level={5}> | ||
{cell.heading} | ||
</Heading> | ||
)} | ||
{cell.description && <Paragraph>{cell.description}</Paragraph>} | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.