Skip to content

Commit 64b1f4d

Browse files
authored
Merge pull request #1396 from AhmedMustafa2201/bugs/copy-address
fix: copy complete link from the # button
2 parents a3252ca + b783909 commit 64b1f4d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/react-renderer-demo/src/components/mdx/share-button.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
33
import IconButton from '@mui/material/IconButton';
44
import CopyToClipboard from 'react-copy-to-clipboard';
55
import SvgIcon from '@mui/material/SvgIcon';
6+
import { urlFormatter } from '../../helpers/url-formatter';
67

78
const HashTagSvg = (props) => (
89
// eslint-disable-next-line max-len
@@ -15,7 +16,7 @@ const HashTagSvg = (props) => (
1516
);
1617

1718
const ShareButton = ({ path }) => (
18-
<CopyToClipboard text={path}>
19+
<CopyToClipboard text={urlFormatter(path)}>
1920
<IconButton size="medium">
2021
<SvgIcon fontSize="small" viewBox="0 0 48 48">
2122
<HashTagSvg />
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const urlFormatter = (initPath) => {
2+
const url = process.env.NEXT_PUBLIC_VERCEL_URL;
3+
4+
return `https://${url + initPath}`;
5+
};

0 commit comments

Comments
 (0)