File tree Expand file tree Collapse file tree 6 files changed +30
-11
lines changed
Expand file tree Collapse file tree 6 files changed +30
-11
lines changed Original file line number Diff line number Diff line change 11import { ArrowUpRightIcon } from '@heroicons/react/24/outline' ;
22import Banner from '@node-core/ui-components/Common/Banner' ;
3+ import { useTranslations } from 'next-intl' ;
34
45import Link from '#site/components/Link' ;
56import { siteConfig } from '#site/next.json.mjs' ;
@@ -9,10 +10,16 @@ import type { FC } from 'react';
910
1011const WithBanner : FC < { section : string } > = ( { section } ) => {
1112 const banner = siteConfig . websiteBanners [ section ] ;
13+ const t = useTranslations ( ) ;
1214
1315 if ( banner && dateIsBetween ( banner . startDate , banner . endDate ) ) {
16+ const bannerType = banner . type || 'default' ;
17+
1418 return (
15- < Banner type = { banner . type } >
19+ < Banner
20+ type = { banner . type }
21+ aria-label = { t ( `components.banner.${ bannerType } ` ) }
22+ >
1623 { banner . link ? (
1724 < Link href = { banner . link } > { banner . text } </ Link >
1825 ) : (
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ const WithMetaBar: FC = () => {
4444 < MetaBar
4545 heading = { t ( 'components.metabar.tableOfContents' ) }
4646 as = { Link }
47+ aria-label = { t ( 'components.metabar.metadata' ) }
4748 items = { {
4849 [ t ( 'components.metabar.lastUpdated' ) ] : lastUpdated ,
4950 [ t ( 'components.metabar.readingTime' ) ] : readingTimeText ,
Original file line number Diff line number Diff line change 280280 "contribute" : " Contribute" ,
281281 "contributeText" : " Edit this page" ,
282282 "viewAs" : " View as" ,
283- "tableOfContents" : " Table of Contents"
283+ "tableOfContents" : " Table of Contents" ,
284+ "metadata" : " Article metadata"
285+ },
286+ "banner" : {
287+ "default" : " Announcement" ,
288+ "warning" : " Warning notification" ,
289+ "error" : " Error notification"
284290 },
285291 "search" : {
286292 "searchPlaceholder" : " Start typing..." ,
Original file line number Diff line number Diff line change 11{
22 "name" : " @node-core/ui-components" ,
3- "version" : " 1.5.4 " ,
3+ "version" : " 1.5.5 " ,
44 "type" : " module" ,
55 "exports" : {
66 "./*" : [
Original file line number Diff line number Diff line change 1- import type { FC , PropsWithChildren } from 'react' ;
1+ import type { FC , HTMLAttributes , PropsWithChildren } from 'react' ;
22
33import styles from './index.module.css' ;
44
55export type BannerProps = {
66 type ?: 'default' | 'warning' | 'error' ;
7- } ;
7+ } & HTMLAttributes < HTMLElement > ;
88
99const Banner : FC < PropsWithChildren < BannerProps > > = ( {
1010 type = 'default' ,
1111 children,
12+ ...props
1213} ) => (
13- < div className = { `${ styles . banner } ${ styles [ type ] || styles . default } ` } >
14+ < section
15+ className = { `${ styles . banner } ${ styles [ type ] || styles . default } ` }
16+ { ...props }
17+ >
1418 { children }
15- </ div >
19+ </ section >
1620) ;
1721
1822export default Banner ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Fragment, useMemo } from 'react';
22
33import type { LinkLike } from '#ui/types' ;
44import type { Heading } from '@vcarl/remark-headings' ;
5- import type { FC } from 'react' ;
5+ import type { FC , HTMLAttributes } from 'react' ;
66
77import styles from './index.module.css' ;
88
@@ -14,13 +14,14 @@ type MetaBarProps = {
1414 } ;
1515 as ?: LinkLike ;
1616 heading : string ;
17- } ;
17+ } & HTMLAttributes < HTMLElement > ;
1818
1919const MetaBar : FC < MetaBarProps > = ( {
2020 items,
2121 headings,
2222 as : Component = 'a' ,
2323 heading,
24+ ...props
2425} ) => {
2526 // The default depth of headings to display in the table of contents.
2627 const { minDepth = 2 , items : headingItems = [ ] } = headings || { } ;
@@ -31,7 +32,7 @@ const MetaBar: FC<MetaBarProps> = ({
3132 ) ;
3233
3334 return (
34- < div className = { styles . wrapper } >
35+ < aside className = { styles . wrapper } { ... props } >
3536 < dl >
3637 { Object . entries ( items )
3738 . filter ( ( [ , value ] ) => ! ! value )
@@ -65,7 +66,7 @@ const MetaBar: FC<MetaBarProps> = ({
6566 </ >
6667 ) }
6768 </ dl >
68- </ div >
69+ </ aside >
6970 ) ;
7071} ;
7172
You can’t perform that action at this time.
0 commit comments