Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/components/share/layout.tsx
1449 views
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>{`${siteName} -- ${title}`}</title>
31
<meta name="description" content="CoCalc Share Server" />
32
{noindex && <meta name="robots" content="noindex,nofollow" />}
33
<link rel="icon" href={favicon} />
34
</Head>
35
<AntdLayout>
36
<Header />
37
<AntdLayout.Content style={{ background: "white" }}>
38
{top}
39
<div
40
style={{
41
color: "#555",
42
margin: "0 auto",
43
maxWidth: SHARE_MAX_WIDTH,
44
fontSize: "11pt",
45
}}
46
>
47
{children}
48
</div>
49
</AntdLayout.Content>
50
<Footer />
51
</AntdLayout>
52
</>
53
);
54
}
55
56
export function Embed({ title, children }: Props) {
57
const { siteName } = useCustomize();
58
return (
59
<>
60
<Head>
61
<title>{`${siteName} -- ${title}`}</title>
62
<link rel="icon" href={favicon} />
63
</Head>
64
<Analytics />
65
<main>{children}</main>
66
</>
67
);
68
}
69
70