feat: image resizer
This commit is contained in:
@@ -141,10 +141,10 @@ function BlockRenderer({ block }: { block: Block }) {
|
||||
<img
|
||||
src={b.url}
|
||||
alt={b.caption || "Image"}
|
||||
style={imageWidth && imageWidth < 100 ? { width: `${imageWidth}%` } : undefined}
|
||||
style={imageWidth ? { width: `min(${imageWidth}px, 100%)` } : undefined}
|
||||
className={cn(
|
||||
"h-auto rounded-md border object-contain",
|
||||
imageWidth && imageWidth < 100 ? "" : "w-full md:w-auto md:max-w-200"
|
||||
imageWidth ? "" : "w-full md:w-auto md:max-w-200"
|
||||
)}
|
||||
/>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export default function CreatePageClient() {
|
||||
|
||||
return (
|
||||
<div className="flex flex-col p-4 md:p-16 gap-6 md:gap-12 mb-4 md:mb-0">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<div className="flex flex-col gap-4 md:flex-row md:items-center justify-between">
|
||||
<h1>Create page</h1>
|
||||
<div className="flex flex-row gap-3">
|
||||
<Button
|
||||
|
||||
+5
-3
@@ -1,7 +1,7 @@
|
||||
import { getPages } from "@/lib/pages/repository";
|
||||
import { getCurrentUser } from "@/lib/user";
|
||||
import { formatDate } from "@/lib/utils";
|
||||
import { ArchiveIcon, CalendarIcon } from "lucide-react";
|
||||
import { ArchiveIcon, CalendarIcon, PencilLineIcon } from "lucide-react";
|
||||
import { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
@@ -14,8 +14,9 @@ export default async function List() {
|
||||
|
||||
const pagesPublished = await getPages("PAGE", "PUBLISHED");
|
||||
const pagesArchived = await getPages("PAGE", "ARCHIVED");
|
||||
const pagesDraft = await getPages("PAGE", "DRAFT");
|
||||
|
||||
const pages = [...pagesPublished, ...pagesArchived].sort((a, b) => {
|
||||
const pages = [...pagesPublished, ...pagesArchived, ...pagesDraft].sort((a, b) => {
|
||||
const aDate = new Date(a.updatedAt ?? a.publishedAt).getTime();
|
||||
const bDate = new Date(b.updatedAt ?? b.publishedAt).getTime();
|
||||
|
||||
@@ -33,8 +34,9 @@ export default async function List() {
|
||||
<h3 className="truncate">{p.title}</h3>
|
||||
</Link>
|
||||
<div className="flex flex-row gap-4">
|
||||
<h5 className="flex gap-1 items-center"><CalendarIcon size={14} />{formatDate(p.publishedAt)}</h5>
|
||||
{p.publishedAt && <h5 className="flex gap-1 items-center"><CalendarIcon size={14} />{formatDate(p.publishedAt)}</h5>}
|
||||
{p.status === "ARCHIVED" && <h5 className="flex gap-1 items-center"><ArchiveIcon size={14} />Archived</h5>}
|
||||
{p.status === "DRAFT" && <h5 className="flex gap-1 items-center"><PencilLineIcon size={14} />Draft</h5>}
|
||||
</div>
|
||||
</div>
|
||||
)) : <h2 className="text-muted-foreground">There are no pages yet...</h2>
|
||||
|
||||
Reference in New Issue
Block a user