committing summative
This commit is contained in:
1 parent
73ac8e85be
commit
95b138f29e
44 files changed
+5319
-755
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { getPubNewsletter } from "@/app/actions/NewsletterActions";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export default async function NewsletterPage({ params }: { params: Promise<{ id: string }>; }) { // next passes in params object when this comp is called
|
||||
const { id } = await params; // [id] catches the value from the url and gives it a param value with the key of id
|
||||
const newsletter = await getPubNewsletter(id);
|
||||
|
||||
if (!newsletter) { // otherwise tries to reference things that dont exist
|
||||
notFound();
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="mx-auto w-full max-w-3xl px-6 py-10">
|
||||
<article>
|
||||
<h1 className="text-4xl font-bold tracking-tight">
|
||||
{newsletter.title}
|
||||
</h1>
|
||||
|
||||
<p className="mt-3 text-sm text-base-content/60">
|
||||
By {newsletter.author.name || "Unnamed author"}
|
||||
</p>
|
||||
|
||||
{newsletter.imageUrl && (
|
||||
<img
|
||||
src={newsletter.imageUrl}
|
||||
alt={newsletter.title}
|
||||
className="mt-6 h-auto w-full rounded-lg"
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="mt-8 whitespace-pre-wrap leading-relaxed">
|
||||
{newsletter.content}
|
||||
</div>
|
||||
</article>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user