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/share/layout.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { ReactNode } from "react";
7
import { join } from "path";
8
import { Layout as AntdLayout } from "antd";
9
import { SHARE_MAX_WIDTH } from "lib/config";
10
import Head from "next/head";
11
import Analytics from "components/analytics";
12
import Footer from "components/landing/footer";
13
import Header from "./header";
14
import basePath from "lib/base-path";
15
import useCustomize from "lib/use-customize";
16
17
const favicon = join(basePath, "webapp/favicon-32x32.png");
18
19
interface Props {
20
title: string;
21
top?: ReactNode;
22
children: ReactNode;
23
}
24
25
export function Layout({ title, children, top }: Props) {
26
const { siteName, noindex } = useCustomize();
27
return (
28
<>
29
<Head>
30
<title>
31
{`${siteName} -- ${title}`}
32
</title>
33
<meta name="description" content="CoCalc Share Server" />
34
{noindex && <meta name="robots" content="noindex,nofollow" />}
35
<link rel="icon" href={favicon} />
36
</Head>
37
<AntdLayout>
38
<Header />
39
<AntdLayout.Content style={{ background: "white" }}>
40
{top}
41
<div
42
style={{
43
color: "#555",
44
margin: "0 auto",
45
maxWidth: SHARE_MAX_WIDTH,
46
fontSize: "11pt",
47
padding: "15px",
48
}}
49
>
50
{children}
51
</div>
52
</AntdLayout.Content>
53
<Footer />
54
</AntdLayout>
55
</>
56
);
57
}
58
59
export function Embed({ title, children }: Props) {
60
const { siteName } = useCustomize();
61
return (
62
<>
63
<Head>
64
<title>
65
{`${siteName} -- ${title}`}
66
</title>
67
<link rel="icon" href={favicon} />
68
</Head>
69
<Analytics />
70
<main>{children}</main>
71
</>
72
);
73
}
74
75