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/components/landing/live-demo.tsx
Views: 687
1
import getSupportUrl from "@cocalc/frontend/support/url";
2
import { Button } from "antd";
3
import { Icon } from "@cocalc/frontend/components/icon";
4
import { useEffect, useState } from "react";
5
6
export function liveDemoUrl(context) {
7
return getSupportUrl({
8
subject: "Contact Us!",
9
type: "chat",
10
context,
11
url: "",
12
});
13
}
14
15
interface Props {
16
context: string;
17
label?;
18
type?;
19
}
20
21
export default function LiveDemo({ context, label, type }: Props) {
22
const [href, setHref] = useState<string | undefined>(undefined);
23
useEffect(() => {
24
setHref(liveDemoUrl(context));
25
}, []);
26
return (
27
<Button href={href} type={type}>
28
<Icon name="users" /> {label ?? "Contact Us!"}
29
</Button>
30
);
31
}
32
33