Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/compute/display-cloud.tsx
1503 views
1
import type { Cloud as CloudType } from "@cocalc/util/db-schema/compute-servers";
2
import { CLOUDS_BY_NAME } from "@cocalc/util/compute/cloud/clouds";
3
import { Icon, isIconName } from "@cocalc/frontend/components/icon";
4
5
interface Props {
6
cloud: CloudType;
7
height?: number | string;
8
style?;
9
}
10
11
export default function DisplayCloud({ cloud, height, style }: Props) {
12
const x = CLOUDS_BY_NAME[cloud];
13
let label;
14
if (x?.image) {
15
label = <img src={x.image} height={height ?? 18} alt={x.label} />;
16
} else {
17
label = x?.label ?? cloud ?? "No Cloud Configured";
18
}
19
return (
20
<span style={style}>
21
{x?.icon && isIconName(x.icon) && <Icon name={x.icon} style={{ marginRight: "5px" }} />}
22
{label}
23
</span>
24
);
25
}
26
27