prod
This commit is contained in:
+17
-8
@@ -139,7 +139,7 @@ export default function Editor({ page, initialBlocks = [], onChange, errors }: E
|
||||
return (
|
||||
<div className="flex flex-col gap-10">
|
||||
<FieldSet>
|
||||
<h2 className=" mb-6">Meta</h2>
|
||||
<h2 className="md:mb-4">Meta</h2>
|
||||
<FieldGroup>
|
||||
<Field data-invalid={!!errors?.title?.length}>
|
||||
<FieldLabel htmlFor="title">Title</FieldLabel>
|
||||
@@ -219,12 +219,12 @@ export default function Editor({ page, initialBlocks = [], onChange, errors }: E
|
||||
</FieldGroup>
|
||||
</FieldSet>
|
||||
|
||||
<div className="flex flex-col gap-1">
|
||||
<h2 className=" mb-6">Content</h2>
|
||||
<div className="flex flex-col gap-4">
|
||||
<h2 className="md:mb-4">Content</h2>
|
||||
{blocks.length === 0 && (
|
||||
<p className="text-sm text-muted-foreground">No blocks yet. Add one below.</p>
|
||||
)}
|
||||
<div className="flex flex-col gap-6">
|
||||
<div className="flex flex-col gap-4 md:gap-6">
|
||||
{blocks.map((block, index) => (
|
||||
<div
|
||||
key={block.id}
|
||||
@@ -234,7 +234,7 @@ export default function Editor({ page, initialBlocks = [], onChange, errors }: E
|
||||
onDrop={() => handleDrop(index)}
|
||||
onDragEnd={() => { setDragIndex(null); setDropIndex(null); }}
|
||||
className={cn(
|
||||
"group relative flex flex-row gap-4 items-start py-1 transition-opacity",
|
||||
"group relative flex flex-row gap-2 md:gap-4 items-start py-1 transition-opacity",
|
||||
dragIndex === index && "opacity-30",
|
||||
dropIndex === index && dragIndex !== index && "border-t-2 border-primary"
|
||||
)}
|
||||
@@ -291,10 +291,19 @@ function BlockInput({ block, onChange }: { block: Block; onChange: (c: Block["co
|
||||
);
|
||||
|
||||
case "HEADING":
|
||||
const level = (block.content as any).level;
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<input
|
||||
className="flex-1 bg-transparent outline-none tracking-tight placeholder:text-muted-foreground"
|
||||
className={cn(
|
||||
"flex-1 min-w-0 bg-transparent outline-none tracking-tight placeholder:text-muted-foreground",
|
||||
{
|
||||
"text-2xl sm:text-3xl": level === 1,
|
||||
"text-xl sm:text-2xl": level === 2,
|
||||
"text-lg sm:text-xl": level === 3,
|
||||
}
|
||||
)}
|
||||
placeholder="Heading"
|
||||
value={(block.content as any).text ?? ""}
|
||||
onChange={(e) => onChange({ type: "HEADING", text: e.target.value, level: (block.content as any).level ?? 2 })}
|
||||
@@ -362,12 +371,12 @@ function BlockInput({ block, onChange }: { block: Block; onChange: (c: Block["co
|
||||
onChange={(e) => onChange({ type: "IMAGE", url: e.target.value })}
|
||||
/>
|
||||
{(block.content as any).url && (
|
||||
<div className="w-max relative rounded-md overflow-hidden border bg-muted/30">
|
||||
<div className="relative max-w-150 rounded-md overflow-hidden border bg-muted/30">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
src={(block.content as any).url}
|
||||
alt="preview"
|
||||
className="max-h-64 w-auto object-contain"
|
||||
className="block max-w-full h-auto object-contain"
|
||||
onError={(e) => { (e.target as HTMLImageElement).style.display = "none"; }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user