react-icons/io#IoMdShare TypeScript Examples
The following examples show how to use
react-icons/io#IoMdShare.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShareButton.tsx From calendar-hack with MIT License | 6 votes |
ShareButton: React.FC<Props> = ({ }) => {
const themeContext = useContext(ThemeContext);
const shareLink = (): void => {
let newVariable: any;
newVariable = window.navigator;
if (newVariable && newVariable.share) {
if (newVariable && newVariable.share) {
newVariable.share({
title: 'defy.org',
text: 'Check this out',
url: `${window.location.href}`,
})
.then(() => console.log('Successful share'))
.catch((error: Error) => console.log('Error sharing', error));
}
} else {
copy(window.location.href);
alert('Link has been copied to clipboard!');
}
}
return (
<IconContext.Provider value={{ color: themeContext.colors.buttonIcons }}>
<Root onClick={shareLink}>
<IoMdShare style={{ verticalAlign: 'middle' }} />
</Root>
</IconContext.Provider>
)
}