Initial commit
This commit is contained in:
54
components/features/features.editor.tsx
Normal file
54
components/features/features.editor.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
import { ComponentConfig } from "@reacteditor/core";
|
||||
import { Sparkles } from "lucide-react";
|
||||
import { Features, type FeaturesProps } from "@/components/features/features";
|
||||
|
||||
export const featuresEditor: ComponentConfig<FeaturesProps> = {
|
||||
label: "Features",
|
||||
icon: <Sparkles size={16} />,
|
||||
category: "content",
|
||||
defaultProps: {
|
||||
tagline: "Why us",
|
||||
heading: "Built with intention",
|
||||
subheading: "A small set of values that shape every piece we make.",
|
||||
columns: "3",
|
||||
items: [
|
||||
{
|
||||
title: "Natural fibers",
|
||||
body: "Linen, organic cotton, and merino — sourced from mills with traceable supply chains.",
|
||||
},
|
||||
{
|
||||
title: "Small batches",
|
||||
body: "Made in considered quantities so nothing goes to waste — and nothing gets discounted into the bin.",
|
||||
},
|
||||
{
|
||||
title: "Built to last",
|
||||
body: "Reinforced seams, double-stitched edges, and finishes that age into something better.",
|
||||
},
|
||||
],
|
||||
},
|
||||
fields: {
|
||||
tagline: { label: "Tagline", type: "text", contentEditable: true },
|
||||
heading: { label: "Heading", type: "text", contentEditable: true },
|
||||
subheading: { label: "Subheading", type: "textarea", contentEditable: true },
|
||||
columns: {
|
||||
label: "Columns",
|
||||
type: "select",
|
||||
options: [
|
||||
{ label: "2 columns", value: "2" },
|
||||
{ label: "3 columns", value: "3" },
|
||||
{ label: "4 columns", value: "4" },
|
||||
],
|
||||
},
|
||||
items: {
|
||||
label: "Items",
|
||||
type: "array",
|
||||
defaultItemProps: { title: "Feature", body: "Description." },
|
||||
getItemSummary: (it) => it?.title || "Feature",
|
||||
arrayFields: {
|
||||
title: { label: "Title", type: "text", contentEditable: true },
|
||||
body: { label: "Body", type: "textarea", contentEditable: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
render: (props) => <Features {...props} />,
|
||||
};
|
||||
49
components/features/features.tsx
Normal file
49
components/features/features.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Typography } from "@/components/Typography";
|
||||
import { Container } from "@/components/layout/Container";
|
||||
import { Heading } from "@/components/Heading";
|
||||
|
||||
export type FeaturesProps = {
|
||||
tagline: string;
|
||||
heading: string;
|
||||
subheading: string;
|
||||
columns: "2" | "3" | "4";
|
||||
items: Array<{ title: string; body: string }>;
|
||||
};
|
||||
|
||||
const colClass: Record<FeaturesProps["columns"], string> = {
|
||||
"2": "md:grid-cols-2",
|
||||
"3": "md:grid-cols-3",
|
||||
"4": "md:grid-cols-2 lg:grid-cols-4",
|
||||
};
|
||||
|
||||
export function Features({ tagline, heading, subheading, columns, items }: FeaturesProps) {
|
||||
return (
|
||||
<section className="bg-background py-20 md:py-28">
|
||||
<Container>
|
||||
<Heading
|
||||
tagline={tagline}
|
||||
title={heading}
|
||||
subtitle={subheading}
|
||||
align="center"
|
||||
size="lg"
|
||||
className="mx-auto mb-16"
|
||||
maxWidth="max-w-2xl"
|
||||
/>
|
||||
|
||||
<div className={`grid grid-cols-1 gap-x-10 gap-y-12 ${colClass[columns]}`}>
|
||||
{items.map((item, i) => (
|
||||
<div key={i} className="flex flex-col gap-3">
|
||||
<Typography variant="caption">
|
||||
{String(i + 1).padStart(2, "0")}
|
||||
</Typography>
|
||||
<Typography variant="h5">{item.title}</Typography>
|
||||
<Typography variant="body2" className="text-muted-foreground">
|
||||
{item.body}
|
||||
</Typography>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user