CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/landing/render-envs.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Typography } from "antd";
7
import React from "react";
8
9
import A from "components/misc/A";
10
import { ExecInfo, SoftwareSpecEntry } from "./types";
11
import SanitizedMarkdown from "components/misc/sanitized-markdown";
12
13
const { Paragraph } = Typography;
14
15
export const VERSION_STYLE: React.CSSProperties = {
16
maxHeight: "8em",
17
whiteSpace: "pre-wrap",
18
backgroundColor: "rgba(150, 150, 150, 0.1)",
19
fontSize: "12px",
20
padding: "10px",
21
overflow: "auto",
22
marginBottom: "20px",
23
} as const;
24
25
interface Props {
26
spec: Record<string, SoftwareSpecEntry>;
27
execInfo?: ExecInfo;
28
}
29
30
export function ExecutableDescription(props: Props) {
31
const { spec, execInfo } = props;
32
function renderEnvs() {
33
const envs: JSX.Element[] = [];
34
for (const [key, info] of Object.entries(spec)) {
35
const version = execInfo?.[info.path];
36
envs.push(
37
<Paragraph key={key}>
38
<dt>
39
<A style={{ fontWeight: "bold" }} href={info.url}>
40
{info.name}
41
</A>
42
:
43
</dt>
44
<dd style={{ marginBottom: "0.5rem" }}>
45
<SanitizedMarkdown value={info.doc} />
46
{version && <div style={VERSION_STYLE}>{version}</div>}
47
</dd>
48
</Paragraph>
49
);
50
}
51
return envs;
52
}
53
54
return <dl>{renderEnvs()}</dl>;
55
}
56
57