The Node.js® Website
1import type { FC } from 'react';
2
3import Badge from '@/components/Common/Badge';
4import { siteConfig } from '@/next.json.mjs';
5import { dateIsBetween } from '@/util/dateUtils';
6
7const WithBadge: FC<{ section: string }> = ({ section }) => {
8 const badge = siteConfig.websiteBadges[section];
9
10 if (badge && dateIsBetween(badge.startDate, badge.endDate)) {
11 return (
12 <Badge badgeText={badge.title} kind={badge.kind} href={badge.link}>
13 {badge.text}
14 </Badge>
15 );
16 }
17
18 return null;
19};
20
21export default WithBadge;