diff --git a/src/app/[lang]/preview-upload/page.tsx b/src/app/[lang]/preview-upload/page.tsx index 0c876e9..4ccc4fd 100644 --- a/src/app/[lang]/preview-upload/page.tsx +++ b/src/app/[lang]/preview-upload/page.tsx @@ -27,10 +27,7 @@ const mockQuestion: QuestionField = { export default function PreviewUploadPage() { return ( - +
{/* Top Bar */}
diff --git a/src/app/globals.css b/src/app/globals.css index e196f81..4f8f63c 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -368,6 +368,14 @@ body[data-page-background="none"] .app-shell, .app-shell:has(.page-background-none), body:has(.page-background-none), html:has(.page-background-none) { + background-image: none !important; + background-color: #F5F5F5 !important; +} + +body[data-page-background="cream"] .app-shell, +.app-shell:has(.page-background-cream), +body:has(.page-background-cream), +html:has(.page-background-cream) { background-image: none !important; background-color: #F7F1F0 !important; } @@ -472,8 +480,8 @@ body.section-overlay-open .app-shell { --app-shell-px: 17px; padding-inline: var(--app-shell-px); box-sizing: border-box; - background-color: var(--background); - background-image: var(--default-page-background-image); + background-color: #F7F1F0; + background-image: none; background-position: top; background-repeat: no-repeat; background-size: cover; @@ -532,6 +540,16 @@ body.section-overlay-open .app-shell { margin-inline: calc(-1 * var(--app-shell-px, 17px)); } +.questions-list-main { + margin-inline: calc(-1 * var(--app-shell-px, 17px)); + padding-inline: var(--app-shell-px, 17px); +} + +.questions-list-header { + margin-inline: calc(-1 * var(--app-shell-px, 17px)); + padding-inline: var(--app-shell-px, 17px); +} + .question-progress, .question-snap-content { transition: @@ -553,6 +571,7 @@ body.section-overlay-open .app-shell { } .page-background-none, +.page-background-cream, .page-background-custom, .page-background-default { display: none; diff --git a/src/app/preview-upload/page.tsx b/src/app/preview-upload/page.tsx index 031aef4..c960807 100644 --- a/src/app/preview-upload/page.tsx +++ b/src/app/preview-upload/page.tsx @@ -40,10 +40,7 @@ const mockDocs = [ export default function RootPreviewUploadPage() { return ( - +
{/* Top Bar */}
diff --git a/src/app/questions-list/[slug]/question-detail-client.tsx b/src/app/questions-list/[slug]/question-detail-client.tsx index 0247088..731a252 100644 --- a/src/app/questions-list/[slug]/question-detail-client.tsx +++ b/src/app/questions-list/[slug]/question-detail-client.tsx @@ -268,6 +268,9 @@ export default function QuestionDetailClient({ const [hasTestProgress, setHasTestProgress] = useState(false); const queryClient = useQueryClient(); const profileId = useCurrentProfileId(); + const isOverlay = Boolean(useSectionOverlay()); + const renderPageBackground = () => + !isOverlay ? : null; const handleExit = useCallback(() => { void queryClient.invalidateQueries({ @@ -520,7 +523,7 @@ export default function QuestionDetailClient({ return ( <> - + {renderPageBackground()}
- + {renderPageBackground()}
- + {renderPageBackground()}
- + {renderPageBackground()}

{isError @@ -780,7 +783,7 @@ export default function QuestionDetailClient({ return ( <> - + {renderPageBackground()}

- + {renderPageBackground()} { @@ -120,4 +121,70 @@ describe("Dimensions & Padding Integrity Verification", () => { expect(mainMatches).not.toBeNull(); expect(mainMatches!.length).toBeGreaterThanOrEqual(4); }); + + it("globals.css defines #F5F5F5 for page-background-none and #F7F1F0 for page-background-cream", () => { + const cssPath = path.resolve(process.cwd(), "src/app/globals.css"); + const cssContent = fs.readFileSync(cssPath, "utf-8"); + + // page-background-none sets #F5F5F5 + expect(cssContent).toMatch( + /body:has\(\.page-background-none\),\s*html:has\(\.page-background-none\)\s*\{[\s\S]*?background-color:\s*#F5F5F5\s*!important;/, + ); + + // page-background-cream sets #F7F1F0 + expect(cssContent).toMatch( + /body:has\(\.page-background-cream\),\s*html:has\(\.page-background-cream\)\s*\{[\s\S]*?background-color:\s*#F7F1F0\s*!important;/, + ); + + // section-overlay uses #F7F1F0 without background-image + expect(cssContent).toMatch( + /\.section-overlay\s*\{[\s\S]*?background-color:\s*#F7F1F0;[\s\S]*?background-image:\s*none;/, + ); + + // questions-list-main and questions-list-header exist + expect(cssContent).toMatch( + /\.questions-list-main\s*\{[\s\S]*?margin-inline:\s*calc\(-1\s*\*\s*var\(--app-shell-px,\s*17px\)\);/, + ); + expect(cssContent).toMatch( + /\.questions-list-header\s*\{[\s\S]*?margin-inline:\s*calc\(-1\s*\*\s*var\(--app-shell-px,\s*17px\)\);/, + ); + }); + + it("questions-list-client uses questions-list-main and questions-list-header without hardcoded -mx-[17px]", () => { + const listClientPath = path.resolve( + process.cwd(), + "src/app/questions-list/questions-list-client.tsx", + ); + const content = fs.readFileSync(listClientPath, "utf-8"); + + expect(content).not.toMatch(/]*className="[^"]*-mx-\[17px\]/); + expect(content).not.toMatch(/]*className="[^"]*-mx-\[17px\]/); + + const mainMatches = content.match( + /]*className="[^"]*questions-list-main/g, + ); + expect(mainMatches).not.toBeNull(); + expect(mainMatches!.length).toBe(3); + + const headerMatches = content.match( + /]*className="[^"]*questions-list-header/g, + ); + expect(headerMatches).not.toBeNull(); + expect(headerMatches!.length).toBe(3); + }); + + it("PageBackground handles disabled, variant cream and default correctly", () => { + const { container: c1 } = render(); + expect(c1.querySelector(".page-background-none")).toBeInTheDocument(); + expect(c1.querySelector(".page-background-cream")).not.toBeInTheDocument(); + + const { container: c2 } = render( + , + ); + expect(c2.querySelector(".page-background-none")).toBeInTheDocument(); + expect(c2.querySelector(".page-background-cream")).toBeInTheDocument(); + + const { container: c3 } = render(); + expect(c3.querySelector(".page-background-default")).toBeInTheDocument(); + }); }); diff --git a/src/app/questions-list/[slug]/test-intro-client.tsx b/src/app/questions-list/[slug]/test-intro-client.tsx index eb1cfee..caaf101 100644 --- a/src/app/questions-list/[slug]/test-intro-client.tsx +++ b/src/app/questions-list/[slug]/test-intro-client.tsx @@ -31,7 +31,7 @@ export default function TestIntroClient({ return ( <> - +
diff --git a/src/app/questions-list/questions-list-client.tsx b/src/app/questions-list/questions-list-client.tsx index 149ea00..5609a5c 100644 --- a/src/app/questions-list/questions-list-client.tsx +++ b/src/app/questions-list/questions-list-client.tsx @@ -721,7 +721,7 @@ export default function QuestionsListClient({
@@ -730,7 +730,7 @@ export default function QuestionsListClient({ style={{ paddingTop: "max(12px, calc(var(--safe-top) + 4px))", }} - className="sticky top-0 z-20 -mx-[17px] flex items-center justify-between bg-[#F5F5F5]/90 px-[17px] pb-3 backdrop-blur-md" + className="questions-list-header sticky top-0 z-20 flex items-center justify-between bg-[#F5F5F5]/90 pb-3 backdrop-blur-md" >
@@ -804,7 +804,7 @@ export default function QuestionsListClient({ style={{ paddingTop: "max(12px, calc(var(--safe-top) + 4px))", }} - className="sticky top-0 z-20 -mx-[17px] flex items-center justify-between bg-[#F5F5F5]/90 px-[17px] pb-3 backdrop-blur-md" + className="questions-list-header sticky top-0 z-20 flex items-center justify-between bg-[#F5F5F5]/90 pb-3 backdrop-blur-md" >
@@ -923,7 +923,7 @@ export default function QuestionsListClient({ style={{ paddingTop: "max(12px, calc(var(--safe-top) + 4px))", }} - className="sticky top-0 z-20 -mx-[17px] flex items-center justify-between bg-[#F5F5F5]/90 px-[17px] pb-3 backdrop-blur-md" + className="questions-list-header sticky top-0 z-20 flex items-center justify-between bg-[#F5F5F5]/90 pb-3 backdrop-blur-md" > { if (!image) return; @@ -23,16 +25,20 @@ export function PageBackground({ }; }, [image]); + let bgClass = "page-background-default"; + if (disabled) { + bgClass = + variant === "cream" + ? "page-background-none page-background-cream" + : "page-background-none"; + } else if (image) { + bgClass = "page-background-custom"; + } + return (