-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathindex.jsx
More file actions
31 lines (24 loc) · 761 Bytes
/
index.jsx
File metadata and controls
31 lines (24 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { lazy, Suspense } from 'preact/compat';
import AnnouncementBanner from './AnnouncementBanner.jsx';
import { loadBanners } from './loadBanners.mjs';
import { remoteConfig, versionMajor } from '#theme/config';
// TODO: Revisit SERVER global usage.
const LazyBanners = SERVER
? null
: lazy(async () => {
const active = await loadBanners(remoteConfig, versionMajor);
if (!active.length) {
return { default: () => null };
}
return { default: () => <AnnouncementBanner banners={active} /> };
});
const RemoteLoadableBanner = SERVER
? () => <div />
: () => (
<div>
<Suspense fallback={null}>
<LazyBanners />
</Suspense>
</div>
);
export default RemoteLoadableBanner;