Path: blob/master/src/packages/frontend/components/next.tsx
1503 views
/* A link to the @cocalc/next site */12import { A } from "./A";3import { join } from "path";4import { appBasePath } from "@cocalc/frontend/customize/app-base-path";56interface Props {7href: string;8style?;9children?;10query?;11sameTab?: boolean;12}1314export default function Next({ href, style, children, query, sameTab }: Props) {15if (query) {16query = Object.entries(query)17.map(18([key, value]) =>19`${encodeURIComponent(key)}=${encodeURIComponent(value as any)}`,20)21.join("&");22}23const href0 = `${join(appBasePath, href)}${query ? "?" + query : ""}`;24if (sameTab) {25return (26<a style={style} href={href0}>27{children}28</a>29);30}31return (32<A style={style} href={href0}>33{children}34</A>35);36}373839