File tree Expand file tree Collapse file tree
src/generators/web/ui/components Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { lazy , Suspense } from 'preact/compat' ;
2+
3+ import AnnouncementBanner from './index.jsx' ;
4+ import { loadBanners } from './loadBanners.mjs' ;
5+
6+ import { remoteConfig , version } from '#theme/config' ;
7+
8+ // TODO: Revisit SERVER global usage (https://github.com/nodejs/doc-kit/issues/353)
9+ const LazyBanners = SERVER
10+ ? null
11+ : lazy ( async ( ) => {
12+ const active = await loadBanners ( remoteConfig , version . major ) ;
13+
14+ if ( ! active . length ) {
15+ return { default : ( ) => null } ;
16+ }
17+
18+ return { default : ( ) => < AnnouncementBanner banners = { active } /> } ;
19+ } ) ;
20+
21+ const RemoteLoadableBanner = SERVER
22+ ? ( ) => < div />
23+ : ( ) => (
24+ < div >
25+ < Suspense fallback = { null } >
26+ < LazyBanners />
27+ </ Suspense >
28+ </ div >
29+ ) ;
30+
31+ export default RemoteLoadableBanner ;
Original file line number Diff line number Diff line change 1- import { lazy , Suspense } from 'preact/compat' ;
1+ import { ArrowUpRightIcon } from '@heroicons/react/24/outline' ;
2+ import Banner from '@node-core/ui-components/Common/Banner' ;
23
3- import AnnouncementBanner from './AnnouncementBanner.jsx' ;
4- import { loadBanners } from './loadBanners.mjs' ;
4+ import styles from './index.module.css' ;
55
6- import { remoteConfig , version } from '#theme/config' ;
6+ /**
7+ * @param {import('./types.d.ts').AnnouncementBannerProps } props
8+ */
9+ const AnnouncementBanner = ( { banners } ) => (
10+ < div role = "region" aria-label = "Announcements" className = { styles . banners } >
11+ { banners . map ( banner => (
12+ < Banner key = { banner . text } type = { banner . type } >
13+ { banner . link ? (
14+ < a href = { banner . link } target = "_blank" rel = "noopener noreferrer" >
15+ { banner . text }
16+ </ a >
17+ ) : (
18+ banner . text
19+ ) }
20+ { banner . link && < ArrowUpRightIcon /> }
21+ </ Banner >
22+ ) ) }
23+ </ div >
24+ ) ;
725
8- // TODO: Revisit SERVER global usage (https://github.com/nodejs/doc-kit/issues/353)
9- const LazyBanners = SERVER
10- ? null
11- : lazy ( async ( ) => {
12- const active = await loadBanners ( remoteConfig , version . major ) ;
13-
14- if ( ! active . length ) {
15- return { default : ( ) => null } ;
16- }
17-
18- return { default : ( ) => < AnnouncementBanner banners = { active } /> } ;
19- } ) ;
20-
21- const RemoteLoadableBanner = SERVER
22- ? ( ) => < div />
23- : ( ) => (
24- < div >
25- < Suspense fallback = { null } >
26- < LazyBanners />
27- </ Suspense >
28- </ div >
29- ) ;
30-
31- export default RemoteLoadableBanner ;
26+ export default AnnouncementBanner ;
Original file line number Diff line number Diff line change 11import TableOfContents from '@node-core/ui-components/Common/TableOfContents' ;
22import Article from '@node-core/ui-components/Containers/Article' ;
33
4- import RemoteLoadableBanner from '../AnnouncementBanner' ;
4+ import RemoteLoadableBanner from '../AnnouncementBanner/RemoteLoadableBanner ' ;
55
66import Footer from '#theme/Footer' ;
77import MetaBar from '#theme/Metabar' ;
You can’t perform that action at this time.
0 commit comments