Skip to content

Commit da9988f

Browse files
committed
refactor: improve appearance of unpopulated ad slot in local environment
1 parent fefca2b commit da9988f

File tree

1 file changed

+9
-4
lines changed
  • web/src/modules/shared/components/client/ads

1 file changed

+9
-4
lines changed

web/src/modules/shared/components/client/ads/AdSlots.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,19 @@ const AdTemplate = ({
5858
}
5959
}, []);
6060

61-
if (!pubId) {
62-
return 'AdSense Client ID is not set';
63-
}
61+
const InfoText = !pubId
62+
? () => (
63+
<p className='text-center my-auto text-xs text-zinc-500 m-4'>
64+
AdSense Client ID is not set
65+
</p>
66+
)
67+
: () => null;
6468

6569
return isHidden ? (
6670
<div className={cn(className, hiddenClassName)}></div>
6771
) : (
6872
<div className={cn(className, isHidden ? hiddenClassName : '')}>
73+
<InfoText />
6974
<Script
7075
async
7176
src={`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${pubId}`}
@@ -114,7 +119,7 @@ export const SideRailAdSlot = ({ className }: { className?: string }) => {
114119
// height with this class: "max-h-[calc(100vh-9rem)]", but then the container doesn't fit to
115120
// the ad content height, always occupying the full viewport height instead. So we use 'max-w-fit'
116121
// to cap the max height to that of the ad.
117-
'flex-0 sticky mb-8 top-24 min-h-96 max-h-fit hidden xl:block w-36 min-w-36 bg-zinc-800/50 rounded-xl',
122+
'flex-0 sticky mb-8 top-24 p-2 min-h-96 max-h-fit hidden xl:block w-36 min-w-36 bg-zinc-800/50 rounded-xl',
118123
className,
119124
)}
120125
adSlot='4995642586'

0 commit comments

Comments
 (0)