-
Notifications
You must be signed in to change notification settings - Fork 20
/
Vars.js
51 lines (49 loc) · 1.58 KB
/
Vars.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react';
// Global variables to be adapted
export const data = {
elemental_slack_name: "#elemental",
elemental_slack_url: "https://rancher-users.slack.com/channels/elemental",
elemental_toolkit_name: "Elemental Toolkit",
elemental_toolkit_url: "https://rancher.github.io/elemental-toolkit",
elemental_operator_name: "Elemental Operator",
elemental_operator_url: "https://github.com/rancher/elemental-operator",
elemental_cli_name: "Elemental CLI",
elemental_cli_url: "https://github.com/rancher/elemental-cli",
elemental_ui_name: "Elemental UI plugin",
elemental_ui_url: "https://github.com/rancher/elemental-ui",
elemental_iso_name: "Elemental ISO",
elemental_register_name: "Elemental Register client",
ranchersystemagent_name: "Rancher System Agent",
ranchersystemagent_url: "https://github.com/rancher/system-agent",
}
/***
* DO NOT TOUCH -- Docusaurus component logic
***/
export default function Vars({children, name, link}) {
// Check if the link variable is set
if (link !== undefined) {
// Check if the link has a trailing path
const linkparts = link.split(/\/(.*)/s)
// Sets the URL to the global variable
var linkurl = `${data[linkparts[0]]}`
// Adds the trailing path if it exists
if (linkparts.length > 2) {
linkurl = `${data[linkparts[0]]}/${linkparts[1]}`
}
if (children !== undefined) {
return (
<a href={linkurl}>{children}</a>
)
}
else {
return (
<a href={linkurl}>{data[name]}</a>
)
}
}
else {
return (
<span>{data[name]}</span>
)
}
}