diff --git a/docusaurus.config.js b/docusaurus.config.js
index 55b2711..9eb1801 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -69,7 +69,7 @@ const config = {
type: 'doc',
docId: 'intro',
position: 'left',
- label: 'Tutorial',
+ label: 'Docs',
},
{
type: 'localeDropdown',
diff --git a/package.json b/package.json
index b696e54..575fbbc 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
"@docusaurus/preset-classic": "2.1.0",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
+ "copy-to-clipboard": "^3.3.2",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2"
diff --git a/src/theme/Navbar/Content/ShareButton.tsx b/src/theme/Navbar/Content/ShareButton.tsx
new file mode 100644
index 0000000..588a7ca
--- /dev/null
+++ b/src/theme/Navbar/Content/ShareButton.tsx
@@ -0,0 +1,21 @@
+import { IconButton } from '@site/src/components/IconButton'
+import React from 'react'
+import Icon from '@site/static/icons/share.svg'
+import styles from './styles.module.scss'
+import copy2clipboard from 'copy-to-clipboard'
+
+export const ShareButton: React.FC<{}> = ({}) => {
+ return (
+ {
+ if (typeof navigator?.share === 'function') navigator.share()
+ else copy2clipboard(window.location.href)
+ }}
+ className={styles.shareButton}
+ >
+
+
+ )
+}
diff --git a/src/theme/Navbar/Content/index.tsx b/src/theme/Navbar/Content/index.tsx
index 5a3d9b4..3706fce 100644
--- a/src/theme/Navbar/Content/index.tsx
+++ b/src/theme/Navbar/Content/index.tsx
@@ -13,6 +13,7 @@ import NavbarItem, { Props as NavbarItemConfig } from '@theme/NavbarItem'
import SearchBar from '@theme/SearchBar'
import clsx from 'clsx'
import React from 'react'
+import { ShareButton } from './ShareButton'
import styles from './styles.module.scss'
function useNavbarItems() {
@@ -79,6 +80,7 @@ export default function NavbarContent(): JSX.Element {
+
{localeDropdown && (
<>
diff --git a/src/theme/Navbar/Content/styles.module.scss b/src/theme/Navbar/Content/styles.module.scss
index af32fdc..eb3ce77 100644
--- a/src/theme/Navbar/Content/styles.module.scss
+++ b/src/theme/Navbar/Content/styles.module.scss
@@ -84,6 +84,14 @@
background-color: #d9d9d9; // TODO: use infima variables
}
+.shareButton {
+ svg,
+ svg * {
+ fill: currentColor;
+ stroke: currentColor;
+ }
+}
+
@include utils.responsive('lg', 'down') {
.root {
padding: 0 var(--ifm-spacing-horizontal);
diff --git a/static/icons/share.svg b/static/icons/share.svg
new file mode 100644
index 0000000..fe0cd06
--- /dev/null
+++ b/static/icons/share.svg
@@ -0,0 +1,3 @@
+
diff --git a/yarn.lock b/yarn.lock
index 228afe1..436e060 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3082,6 +3082,13 @@ copy-text-to-clipboard@^3.0.1:
resolved "https://registry.yarnpkg.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.0.1.tgz#8cbf8f90e0a47f12e4a24743736265d157bce69c"
integrity sha512-rvVsHrpFcL4F2P8ihsoLdFHmd404+CMg71S756oRSeQgqk51U3kicGdnvfkrxva0xXH92SjGS62B0XIJsbh+9Q==
+copy-to-clipboard@^3.3.2:
+ version "3.3.2"
+ resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.2.tgz#5b263ec2366224b100181dded7ce0579b340c107"
+ integrity sha512-Vme1Z6RUDzrb6xAI7EZlVZ5uvOk2F//GaxKUxajDqm9LhOVM1inxNAD2vy+UZDYsd0uyA9s7b3/FVZPSxqrCfg==
+ dependencies:
+ toggle-selection "^1.0.6"
+
copy-webpack-plugin@^11.0.0:
version "11.0.0"
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz#96d4dbdb5f73d02dd72d0528d1958721ab72e04a"
@@ -7065,6 +7072,11 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"
+toggle-selection@^1.0.6:
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32"
+ integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==
+
toidentifier@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"