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/social-media-share-links.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2024 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Space } from "antd";
7
8
import { Icon } from "@cocalc/frontend/components/icon";
9
import { COLORS } from "@cocalc/util/theme";
10
import { CSS } from "components/misc";
11
import A from "components/misc/A";
12
13
interface SocialMediaShareLinksProps {
14
title: string;
15
url: string,
16
showText?: boolean;
17
standalone?: boolean; // default false
18
}
19
20
export function SocialMediaShareLinks(props: SocialMediaShareLinksProps) {
21
const {
22
title,
23
url,
24
standalone = false,
25
showText = false,
26
} = props;
27
28
const bottomLinkStyle: CSS = {
29
color: COLORS.ANTD_LINK_BLUE,
30
...(standalone ? { fontSize: "125%", fontWeight: "bold" } : {}),
31
};
32
33
const srcLink = encodeURIComponent(url);
34
35
return (
36
<Space size="middle" direction="horizontal">
37
<A
38
key="tweet"
39
href={`https://twitter.com/intent/tweet?text=${encodeURIComponent(
40
title,
41
)}&url=${srcLink}&via=cocalc_com`}
42
style={{ color: COLORS.ANTD_LINK_BLUE, ...bottomLinkStyle }}
43
>
44
<Icon name="twitter" />
45
{showText ? " Tweet" : ""}
46
</A>
47
<A
48
key="facebook"
49
href={`https://www.facebook.com/sharer/sharer.php?u=${srcLink}`}
50
style={{ ...bottomLinkStyle }}
51
>
52
<Icon name="facebook-filled" />
53
{showText ? " Share" : ""}
54
</A>
55
<A
56
key="linkedin"
57
href={`https://www.linkedin.com/sharing/share-offsite/?url=${srcLink}`}
58
style={{ ...bottomLinkStyle }}
59
>
60
<Icon name="linkedin-filled" />
61
{showText ? " Share" : ""}
62
</A>
63
</Space>
64
);
65
}
66
67