-
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
560f8ed
commit c38ca66
Showing
13 changed files
with
10,388 additions
and
155 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import { themeField } from "@/fields/theme"; | ||
import type { Block } from "payload"; | ||
|
||
export const SolutionShowcase: Block = { | ||
slug: "solutionShowcase", | ||
interfaceName: "SolutionShowcaseBlock", | ||
labels: { | ||
singular: "Solution Showcase", | ||
plural: "Solution Showcases", | ||
}, | ||
fields: [ | ||
themeField(), | ||
{ | ||
name: "heading", | ||
type: "group", | ||
fields: [ | ||
{ | ||
name: "title", | ||
type: "text", | ||
required: true, | ||
}, | ||
{ | ||
name: "description", | ||
type: "textarea", | ||
}, | ||
{ | ||
name: "alignment", | ||
type: "select", | ||
defaultValue: "center", | ||
options: [ | ||
{ label: "Center", value: "center" }, | ||
{ label: "Left", value: "left" }, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "solutions", | ||
type: "array", | ||
required: true, | ||
minRows: 1, | ||
admin: { | ||
description: "Add solutions or use cases to display", | ||
}, | ||
fields: [ | ||
themeField(), | ||
{ | ||
name: "title", | ||
type: "text", | ||
required: true, | ||
}, | ||
{ | ||
name: "description", | ||
type: "textarea", | ||
required: true, | ||
}, | ||
|
||
{ | ||
name: "media", | ||
type: "group", | ||
fields: [ | ||
{ | ||
name: "mediaType", | ||
type: "radio", | ||
defaultValue: "image", | ||
enumName: "enum_solutionshowcase_media_type", | ||
options: [ | ||
{ | ||
label: "Image", | ||
value: "image", | ||
}, | ||
{ | ||
label: "Icon", | ||
value: "icon", | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "image", | ||
type: "upload", | ||
relationTo: "media", | ||
required: true, | ||
admin: { | ||
condition: (_, { mediaType } = {}) => { | ||
return mediaType === "image"; | ||
}, | ||
}, | ||
filterOptions: { | ||
mimeType: { contains: "image" }, | ||
}, | ||
}, | ||
{ | ||
name: "icon", | ||
type: "text", | ||
required: true, | ||
label: "Icon Name", | ||
admin: { | ||
condition: (_, { mediaType } = {}) => mediaType === "icon", | ||
description: "Name of the Lucide icon to use", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}; |
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,92 @@ | ||
import { ColorMode } from "@/components/cms/color-mode"; | ||
import { Media } from "@/components/cms/media"; | ||
import { Feature } from "@/components/ui/feature"; | ||
import { Icon, type IconName } from "@/components/ui/icon"; | ||
import { Heading, Paragraph } from "@/components/ui/typography"; | ||
import { cn } from "@/lib/utils"; | ||
import type { SolutionShowcaseBlock as SolutionShowcaseBlockProps } from "@/payload-types"; | ||
|
||
type Props = SolutionShowcaseBlockProps; | ||
|
||
export const SolutionShowcaseBlock = ({ theme, heading, solutions }: Props) => { | ||
return ( | ||
<ColorMode | ||
as="section" | ||
className="py-16 space-y-8 lg:space-y-12" | ||
theme={theme} | ||
> | ||
{/* Headline Section */} | ||
{heading && ( | ||
<div className="layout"> | ||
<div | ||
className={cn( | ||
"col-span-full mb-12 space-y-4", | ||
"lg:col-span-8", | ||
heading.alignment === "center" ? "text-center" : "text-left" | ||
)} | ||
> | ||
<h2 className="text-4xl md:text-5xl font-bold text-foreground"> | ||
{heading.title} | ||
</h2> | ||
{heading.description && ( | ||
<p className="text-lg text-muted-foreground"> | ||
{heading.description} | ||
</p> | ||
)} | ||
</div> | ||
</div> | ||
)} | ||
|
||
<div className="layout"> | ||
{Array.isArray(solutions) && | ||
solutions.map((solution, index) => ( | ||
<ColorMode | ||
key={`${solution.id}`} | ||
theme={solution.theme} | ||
className={cn( | ||
"col-span-full @container h-full", | ||
index % 4 === 0 | ||
? "md:col-span-2 lg:col-span-8" | ||
: index % 4 === 1 | ||
? "md:col-span-1 lg:col-span-4" | ||
: "md:col-span-1 lg:col-span-6" | ||
)} | ||
> | ||
<Feature.Root className="h-full"> | ||
<Feature.TextWrapper className="space-y-2"> | ||
<Heading as="h4" level={5}> | ||
{solution.title} | ||
</Heading> | ||
|
||
<Paragraph color="muted">{solution.description}</Paragraph> | ||
</Feature.TextWrapper> | ||
{/* Media handling */} | ||
{solution.media && | ||
solution.media.mediaType === "image" && | ||
solution.media?.image && ( | ||
<Feature.Media> | ||
<Media | ||
resource={solution.media.image} | ||
className="w-full h-full object-cover rounded-2xl" | ||
imgClassName="rounded-2xl" | ||
/> | ||
</Feature.Media> | ||
)} | ||
|
||
{solution.media && | ||
solution.media.mediaType === "icon" && | ||
solution.media?.icon && ( | ||
<div className="relative w-12 h-12 my-4"> | ||
<Icon | ||
name={solution.media.icon as IconName} | ||
className="w-full h-full object-contain" | ||
/> | ||
</div> | ||
)} | ||
</Feature.Root> | ||
</ColorMode> | ||
))} | ||
</div> | ||
</ColorMode> | ||
); | ||
}; |
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.