itaditya / trick-or-treat-game

Play it for free here
https://trick-or-treat.netlify.com/
16 stars 17 forks source link

Allow user to share their score on Twitter. #18

Closed itaditya closed 4 years ago

itaditya commented 4 years ago

Next to the user score, show a "Share on Twitter" button. Pressing on it lets user submit their score on Twitter as text.

Additonally- Generate a cool image like a scorecard for user to post on Twitter. This carries more WOW factor.

2pai commented 4 years ago

can we use react-twitter-embed ?

itaditya commented 4 years ago

We just need an anchor tag like this https://developer.twitter.com/en/docs/twitter-for-websites/tweet-button/overview

Using a library for it would be an overkill. But thanks for letting me know about this awesome library.

bennetthanna commented 4 years ago

I would like to work on this one if that's okay

itaditya commented 4 years ago

Just this code is enough for opening Twitter page in new tab with prefilled content

<a href="https://twitter.com/intent/tweet?url=https://trick-or-treat.netlify.com&text=I finished the game in 48 moves." target="_blank" title="Share on Twitter">
  Share on Twitter
</a>

No need of any JS. The criteria for acceptance is that the button also looks just like the Share Tweet button. So you have to work on the CSS. The button text should be "Share your score on Twitter"

Make sure to replace the number 48 with the moves the player gets in the game.

itaditya commented 4 years ago

fixed by #45