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/frontend/components/next.tsx
Views: 687
1
/* A link to the @cocalc/next site */
2
3
import { A } from "./A";
4
import { join } from "path";
5
import { appBasePath } from "@cocalc/frontend/customize/app-base-path";
6
7
interface Props {
8
href: string;
9
style?;
10
children?;
11
query?;
12
}
13
14
export default function Next({ href, style, children, query }: Props) {
15
if (query) {
16
query = Object.entries(query)
17
.map(
18
([key, value]) =>
19
`${encodeURIComponent(key)}=${encodeURIComponent(value as any)}`
20
)
21
.join("&");
22
}
23
return (
24
<A
25
style={style}
26
href={`${join(appBasePath, href)}${query ? "?" + query : ""}`}
27
>
28
{children}
29
</A>
30
);
31
}
32
33