MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / WithBanner

Function WithBanner

apps/site/components/withBanner.tsx:11–34  ·  view source on GitHub ↗
({ section })

Source from the content-addressed store, hash-verified

9import type { FC } from 'react';
10
11const WithBanner: FC<{ section: string }> = ({ section }) => {
12 const banner = siteConfig.websiteBanners[section];
13 const t = useTranslations();
14
15 if (banner && dateIsBetween(banner.startDate, banner.endDate)) {
16 const bannerType = banner.type || 'default';
17
18 return (
19 <Banner
20 type={banner.type}
21 aria-label={t(`components.banner.${bannerType}`)}
22 >
23 {banner.link ? (
24 <Link href={banner.link}>{banner.text}</Link>
25 ) : (
26 banner.text
27 )}
28 {banner.link && <ArrowUpRightIcon />}
29 </Banner>
30 );
31 }
32
33 return null;
34};
35
36export default WithBanner;

Callers

nothing calls this directly

Calls 1

dateIsBetweenFunction · 0.90

Tested by

no test coverage detected