diff --git a/src/App.js b/src/App.js index 92b83a316..4533f826b 100644 --- a/src/App.js +++ b/src/App.js @@ -36,7 +36,31 @@ const App = () => { ) -} + const Quote = ({ quote, author }) => { + const shareOnWhatsApp = () => { + const text = encodeURIComponent(`"${quote}" - ${author}`); + window.open(`https://api.whatsapp.com/send?text=${text}`); + }; + + const shareOnTwitter = () => { + const text = encodeURIComponent(`"${quote}" - ${author}`); + window.open(`https://twitter.com/intent/tweet?text=${text}`); + }; + + return ( +
+

{quote}

+

- {author}

+
+ Share on WhatsApp + Share on Twitter + +
+
+ ); + }; + } + export default App;