diff --git a/apps/site/components/withBanner.tsx b/apps/site/components/withBanner.tsx index 670307e729a8e..2f58eef5227e0 100644 --- a/apps/site/components/withBanner.tsx +++ b/apps/site/components/withBanner.tsx @@ -1,5 +1,6 @@ import { ArrowUpRightIcon } from '@heroicons/react/24/outline'; import Banner from '@node-core/ui-components/Common/Banner'; +import { useTranslations } from 'next-intl'; import Link from '#site/components/Link'; import { siteConfig } from '#site/next.json.mjs'; @@ -9,10 +10,20 @@ import type { FC } from 'react'; const WithBanner: FC<{ section: string }> = ({ section }) => { const banner = siteConfig.websiteBanners[section]; + const t = useTranslations(); if (banner && dateIsBetween(banner.startDate, banner.endDate)) { + const ariaLabels = { + default: t('components.banner.announcement'), + warning: t('components.banner.warning'), + error: t('components.banner.error'), + } as const; + + // Fallback to 'default' if no type is specified + const bannerType = banner.type || 'default'; + return ( - + {banner.link ? ( {banner.text} ) : ( diff --git a/apps/site/components/withMetaBar.tsx b/apps/site/components/withMetaBar.tsx index 7467753567b8c..dea25e5900e19 100644 --- a/apps/site/components/withMetaBar.tsx +++ b/apps/site/components/withMetaBar.tsx @@ -44,6 +44,7 @@ const WithMetaBar: FC = () => { ; const Banner: FC> = ({ type = 'default', children, + ...props }) => ( -
+
{children} -
+ ); export default Banner; diff --git a/packages/ui-components/src/Containers/MetaBar/index.tsx b/packages/ui-components/src/Containers/MetaBar/index.tsx index 2c314a61414ec..c761cfe07f643 100644 --- a/packages/ui-components/src/Containers/MetaBar/index.tsx +++ b/packages/ui-components/src/Containers/MetaBar/index.tsx @@ -2,7 +2,7 @@ import { Fragment, useMemo } from 'react'; import type { LinkLike } from '#ui/types'; import type { Heading } from '@vcarl/remark-headings'; -import type { FC } from 'react'; +import type { FC, HTMLAttributes } from 'react'; import styles from './index.module.css'; @@ -14,13 +14,14 @@ type MetaBarProps = { }; as?: LinkLike; heading: string; -}; +} & HTMLAttributes; const MetaBar: FC = ({ items, headings, as: Component = 'a', heading, + ...props }) => { // The default depth of headings to display in the table of contents. const { minDepth = 2, items: headingItems = [] } = headings || {}; @@ -31,7 +32,7 @@ const MetaBar: FC = ({ ); return ( -
+
+ ); };