feat: Update poster dimensions to A4 size and enhance PDF generation tests

This commit is contained in:
hamed
2026-08-09 13:59:37 +03:30
parent 54bebbd41a
commit 5e86f115d3
6 changed files with 131 additions and 17 deletions
+4 -2
View File
@@ -47,7 +47,7 @@ function PosterLight({ data, onQrReady }) {
return (
<div
dir="rtl"
className="relative w-[1080px] h-[1350px] overflow-hidden flex flex-col bg-[#F6F9FD] text-center"
className="relative w-[1080px] h-[1527px] overflow-hidden flex flex-col bg-[#F6F9FD] text-center"
>
{/* top brand band */}
<div
@@ -71,7 +71,9 @@ function PosterLight({ data, onQrReady }) {
</div>
</div>
<div className="flex-1 px-[72px] flex flex-col items-center">
{/* بالا-چین می‌ماند تا آواتار روی نوار بالایی سوار بماند؛ فاصلهٔ اضافیِ کاغذ A4
به‌صورت فضای خالی بالای فوتر می‌نشیند، نه بین آواتار و نوار. */}
<div className="flex-1 px-[72px] pb-[40px] flex flex-col items-center">
{/* avatar overlapping band */}
<div className="-mt-[8px] pt-[40px]">
<div
+5 -3
View File
@@ -84,7 +84,7 @@ function Poster({ data, onQrReady }) {
return (
<div
dir="rtl"
className="relative w-[1080px] h-[1350px] overflow-hidden flex flex-col p-[64px] text-right"
className="relative w-[1080px] h-[1527px] overflow-hidden flex flex-col p-[64px] text-right"
style={{ background: POSTER_BG }}
>
<div className="pointer-events-none absolute -top-[180px] -left-[180px] w-[520px] h-[520px] rounded-full bg-[#57A6FF]/20 blur-[80px]" />
@@ -176,9 +176,11 @@ function Poster({ data, onQrReady }) {
</section>
{/* body */}
<section className="relative mt-[36px] flex-1">
{/* کارت‌ها به هم چسبیده می‌مانند و فاصلهٔ اضافیِ کاغذ A4 بالای فوتر می‌نشیند:
حفرهٔ وسطِ صفحه شبیه محتوای جاافتاده دیده می‌شد. */}
<section className="relative mt-[36px] flex-1 flex flex-col gap-[28px]">
{shownServices.length > 0 && (
<div className="rounded-[28px] bg-white/6 border border-white/10 p-[32px] mb-[28px]">
<div className="rounded-[28px] bg-white/6 border border-white/10 p-[32px]">
<SectionTitle icon={<ClipBoard />}>خدمات</SectionTitle>
<div className="flex flex-wrap items-center gap-x-[12px] gap-y-[14px]">
{shownServices.map((s, i) => (
+5 -2
View File
@@ -49,13 +49,16 @@ describe.each([
expect(screen.getByText(/تخصص دیگر/)).toBeInTheDocument();
});
it("کادر ثابت ۱۰۸۰×۱۳۵۰ و overflow-hidden دست‌نخورده است", () => {
// ۱۰۸۰×۱۵۲۷ همان نسبت A4 است (۲۱۰:۲۹۷). هر عدد دیگری یعنی PDF یا حاشیهٔ سفید
// می‌گیرد یا از کاغذ بیرون می‌زند.
it("کادر ثابت ۱۰۸۰×۱۵۲۷ با نسبت A4 و overflow-hidden دست‌نخورده است", () => {
const { container } = render(<Component data={JAHANTAB} />);
const frame = container.firstChild;
expect(frame.className).toContain("w-[1080px]");
expect(frame.className).toContain("h-[1350px]");
expect(frame.className).toContain("h-[1527px]");
expect(frame.className).toContain("overflow-hidden");
expect(1527 / 1080).toBeCloseTo(297 / 210, 2);
});
it("خط زیرتخصص از بودجهٔ کاراکتر نمی‌گذرد", () => {