Skip to content

Commit da2d412

Browse files
authored
added version as scale-tag in FooterCopyright #184 (#207)
1 parent e2c7ff2 commit da2d412

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

docusaurus.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ const config: Config = {
212212
],
213213
},
214214
],
215-
copyright: `© T-Systems International GmbH ${new Date().getFullYear()} (` + process.env.REACT_APP_VERSION + `)`,
215+
copyright: `© T-Systems International GmbH ${new Date().getFullYear()}`,
216216
},
217217
prism: {
218218
additionalLanguages: ['powershell', 'bash'],
@@ -262,7 +262,7 @@ const config: Config = {
262262
} satisfies Preset.ThemeConfig,
263263

264264
customFields: {
265-
version: `(v` + process.env.REACT_APP_VERSION + `)`,
265+
version: process.env.REACT_APP_VERSION,
266266
},
267267

268268
plugins: [
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
import type { Props } from '@theme/Footer/Copyright';
2+
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
23

34
export default function FooterCopyright({ copyright }: Props): JSX.Element {
5+
const { siteConfig } = useDocusaurusContext();
6+
const version: string = siteConfig.customFields.version as string;
7+
8+
let color: string = "orange"
9+
if (version.startsWith("v")) {
10+
color = "cyan"
11+
} else if (version.includes("-development")){
12+
color = "violet"
13+
}
14+
415
return (
5-
<span slot="notice">{copyright}</span>
16+
<>
17+
<span slot="notice">{copyright} <scale-tag size="small" style={{margin: '0 0 0 8px'}} color={color} type="strong">{version}</scale-tag></span>
18+
</>
619
);
720
}

src/theme/Footer/index.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@ import FooterLinks from '@theme/Footer/Links';
55
import FooterLogo from '@theme/Footer/Logo';
66
import FooterCopyright from '@theme/Footer/Copyright';
77
import FooterLayout from '@theme/Footer/Layout';
8-
// import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; // get metadata about page
98

109
function Footer(): JSX.Element | null {
11-
// const context = useDocusaurusContext();
12-
// const { siteConfig = {} } = context;
13-
1410
const {footer} = useThemeConfig();
1511
if (!footer) {
1612
return null;
1713
}
1814
const {copyright, links, logo, style} = footer;
19-
// const {version} = siteConfig.customFields["version"];
2015
return (
2116
<FooterLayout
2217
style={style}

0 commit comments

Comments
 (0)