Skip to content

Commit 30e8193

Browse files
committed
Update docs with version warning
1 parent 14fb076 commit 30e8193

File tree

7 files changed

+149
-0
lines changed

7 files changed

+149
-0
lines changed

website/docusaurus.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ const config = {
195195
darkTheme: darkCodeTheme,
196196
additionalLanguages: ['kotlin', 'java', 'ruby', 'swift', 'toml'],
197197
},
198+
announcementBar: {
199+
id: 'kmmbridge_old_bar',
200+
content:
201+
'These docs are for older versions of KMMBridge. Please go to <a target="_blank" href="https://touchlab.co/kmmbridge/">https://touchlab.co/kmmbridge/</a> for the updated KMMBridge info.',
202+
isCloseable: true,
203+
},
198204
}),
199205
};
200206

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import {translate} from '@docusaurus/Translate';
4+
import IconClose from '@theme/Icon/Close';
5+
import styles from './styles.module.css';
6+
export default function AnnouncementBarCloseButton(props) {
7+
return (
8+
<button
9+
type="button"
10+
aria-label={translate({
11+
id: 'theme.AnnouncementBar.closeButtonAriaLabel',
12+
message: 'Close',
13+
description: 'The ARIA label for close button of announcement bar',
14+
})}
15+
{...props}
16+
className={clsx('clean-btn close', styles.closeButton, props.className)}>
17+
<IconClose width={14} height={14} strokeWidth={3.1} />
18+
</button>
19+
);
20+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.closeButton {
2+
padding: 0;
3+
line-height: 0;
4+
@apply text-white opacity-100;
5+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import {useThemeConfig} from '@docusaurus/theme-common';
4+
import styles from './styles.module.css';
5+
export default function AnnouncementBarContent(props) {
6+
const {announcementBar} = useThemeConfig();
7+
const {content} = announcementBar;
8+
return (
9+
<div
10+
{...props}
11+
className={clsx(styles.content, props.className)}
12+
// Developer provided the HTML, so assume it's safe.
13+
// eslint-disable-next-line react/no-danger
14+
dangerouslySetInnerHTML={{__html: content}}
15+
/>
16+
);
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.content {
2+
font-size: 85%;
3+
text-align: center;
4+
padding: 5px 0;
5+
}
6+
7+
.content a {
8+
color: inherit;
9+
text-decoration: underline;
10+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react';
2+
import {useThemeConfig} from '@docusaurus/theme-common';
3+
import {useAnnouncementBar} from '@docusaurus/theme-common/internal';
4+
import AnnouncementBarCloseButton from '@theme/AnnouncementBar/CloseButton';
5+
import AnnouncementBarContent from '@theme/AnnouncementBar/Content';
6+
import styles from './styles.module.css';
7+
export default function AnnouncementBar() {
8+
const {announcementBar} = useThemeConfig();
9+
const {isActive, close} = useAnnouncementBar();
10+
if (!isActive) {
11+
return null;
12+
}
13+
const {backgroundColor, textColor, isCloseable} = announcementBar;
14+
return (
15+
<div
16+
className={`${styles.announcementBar} kmmbridge_old_bar`}
17+
style={{backgroundColor, color: textColor}}
18+
role="banner">
19+
{isCloseable && <div className={styles.announcementBarPlaceholder} />}
20+
<AnnouncementBarContent className={styles.announcementBarContent} />
21+
{isCloseable && (
22+
<AnnouncementBarCloseButton
23+
onClick={close}
24+
className={styles.announcementBarClose}
25+
/>
26+
)}
27+
</div>
28+
);
29+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
:root {
2+
--docusaurus-announcement-bar-height: auto;
3+
}
4+
5+
.announcementBar {
6+
@apply py-4;
7+
background: repeating-linear-gradient(
8+
45deg,
9+
#ff3333,
10+
#ff3333 10px,
11+
#cc3333 10px,
12+
#cc3333 20px
13+
);
14+
@apply text-2xl font-bold text-white;
15+
text-shadow: 1px 1px 7px #000;
16+
display: flex;
17+
align-items: center;
18+
19+
/*
20+
Unfortunately we can't make announcement bar render above the navbar
21+
IE need to use border-bottom instead of shadow
22+
See https://github.com/facebookincubator/infima/issues/275
23+
24+
box-shadow: var(--ifm-global-shadow-lw);
25+
z-index: calc(var(--ifm-z-index-fixed) + 1);
26+
*/
27+
border-bottom: 1px solid var(--ifm-color-emphasis-100);
28+
}
29+
30+
html[data-announcement-bar-initially-dismissed='true'] .announcementBar {
31+
display: none;
32+
}
33+
34+
.announcementBarPlaceholder {
35+
flex: 0 0 10px;
36+
}
37+
38+
.announcementBarClose {
39+
flex: 0 0 30px;
40+
align-self: stretch;
41+
}
42+
43+
.announcementBarContent {
44+
flex: 1 1 auto;
45+
}
46+
47+
@media print {
48+
.announcementBar {
49+
display: none;
50+
}
51+
}
52+
53+
@media (min-width: 997px) {
54+
:root {
55+
--docusaurus-announcement-bar-height: 30px;
56+
}
57+
58+
.announcementBarPlaceholder,
59+
.announcementBarClose {
60+
flex-basis: 50px;
61+
}
62+
}

0 commit comments

Comments
 (0)