Adjust ad positioning on article pages for better display

Modify `PageSideAds` component to accept `contentHalfWidth` prop for dynamic ad placement based on content container width, and update specific pages (article, about, datenschutz, empfang, impressum, search) to pass the correct values.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 23852c00-4779-460a-9e0c-d09fee4b6c92
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: a7feb44f-676a-4a21-8ede-a392a39b3b56
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/23852c00-4779-460a-9e0c-d09fee4b6c92/nlGTLC9
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sebastjanartic
2026-03-06 08:24:17 +00:00
parent d827d524f9
commit 155914238d
10 changed files with 603 additions and 772 deletions
+5 -3
View File
@@ -121,10 +121,12 @@ export function MultiplexAd() {
);
}
export function PageSideAds() {
export function PageSideAds({ contentHalfWidth = 640 }: { contentHalfWidth?: number }) {
const gap = 10;
const offset = contentHalfWidth + gap;
return (
<div className="relative">
<div className="hidden 2xl:flex fixed top-0 bottom-0 w-[160px] z-10 items-center justify-center pointer-events-none" style={{ left: "calc(50% - 640px - 170px)" }} data-testid="ad-left-sidebar">
<div className="hidden 2xl:flex fixed top-0 bottom-0 w-[160px] z-10 items-center justify-center pointer-events-none" style={{ left: `calc(50% - ${offset}px - 160px)` }} data-testid="ad-left-sidebar">
<div className="pointer-events-auto">
<AdSense
slot="2398082838"
@@ -133,7 +135,7 @@ export function PageSideAds() {
/>
</div>
</div>
<div className="hidden 2xl:flex fixed top-0 bottom-0 w-[160px] z-10 items-center justify-center pointer-events-none" style={{ right: "calc(50% - 640px - 170px)" }} data-testid="ad-right-sidebar">
<div className="hidden 2xl:flex fixed top-0 bottom-0 w-[160px] z-10 items-center justify-center pointer-events-none" style={{ right: `calc(50% - ${offset}px - 160px)` }} data-testid="ad-right-sidebar">
<div className="pointer-events-auto">
<AdSense
slot="2398082838"
+1 -1
View File
@@ -9,7 +9,7 @@ export default function AboutPage() {
return (
<div className="min-h-screen bg-background">
<Header />
<PageSideAds />
<PageSideAds contentHalfWidth={384} />
<main className="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div className="flex items-center gap-3 mb-8">
<Tv className="w-7 h-7 text-primary" />
+1 -1
View File
@@ -164,7 +164,7 @@ export default function ArticlePage() {
return (
<div className="min-h-screen bg-background">
<Header />
<PageSideAds />
<PageSideAds contentHalfWidth={448} />
<main className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<Link href="/">
<Button variant="ghost" size="sm" className="mb-6 gap-2" data-testid="button-back">
+1 -1
View File
@@ -9,7 +9,7 @@ export default function DatenschutzPage() {
return (
<div className="min-h-screen bg-background">
<Header />
<PageSideAds />
<PageSideAds contentHalfWidth={384} />
<main className="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div className="flex items-center gap-3 mb-8">
<Shield className="w-7 h-7 text-primary" />
+1 -1
View File
@@ -38,7 +38,7 @@ export default function EmpfangPage() {
return (
<div className="min-h-screen bg-background">
<Header />
<PageSideAds />
<PageSideAds contentHalfWidth={448} />
<main className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div className="flex items-center gap-3 mb-2">
<Tv className="w-7 h-7 text-primary" />
+1 -1
View File
@@ -9,7 +9,7 @@ export default function ImpressumPage() {
return (
<div className="min-h-screen bg-background">
<Header />
<PageSideAds />
<PageSideAds contentHalfWidth={384} />
<main className="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div className="flex items-center gap-3 mb-8">
<Scale className="w-7 h-7 text-primary" />
+1 -1
View File
@@ -77,7 +77,7 @@ export default function SearchPage() {
return (
<div className="min-h-screen bg-background" data-testid="page-search">
<Header />
<PageSideAds />
<PageSideAds contentHalfWidth={512} />
<main className="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<Link href="/">
<button className="flex items-center gap-1 text-muted-foreground hover:text-foreground text-sm mb-4 transition-colors" data-testid="link-back-home">