This commit is contained in:
Lynn 2022-01-18 17:09:12 +01:00
parent 8df7a8da6f
commit ca7f46667d
3 changed files with 15 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# hello wordl # hello wordl
It's [Wordle](https://www.powerlanguage.co.uk/wordle/) but you can play forever! It's [Wordle](https://www.powerlanguage.co.uk/wordle/) but you can play forever!
Play it [here](http://foldr.moe/hello-wordl/). Play it [here](https://foldr.moe/hello-wordl/).
## Introduction ## Introduction
Wordle is a word game similar to the TV show [Lingo](https://en.wikipedia.org/wiki/Lingo_(British_game_show)). Wordle is a word game similar to the TV show [Lingo](https://en.wikipedia.org/wiki/Lingo_(British_game_show)).

View file

@ -1,7 +1,7 @@
{ {
"name": "wordl", "name": "wordl",
"version": "0.1.0", "version": "0.1.0",
"homepage": "https://lynn.github.io/hello-wordl", "homepage": "http://hellowordl.net/",
"private": false, "private": false,
"dependencies": { "dependencies": {
"@testing-library/jest-dom": "^5.16.1", "@testing-library/jest-dom": "^5.16.1",

View file

@ -234,8 +234,19 @@ function Game(props: GameProps) {
<p> <p>
<button <button
onClick={() => { onClick={() => {
navigator.clipboard.writeText(getChallengeUrl(target)); const url = getChallengeUrl(target);
setHint("Challenge link copied to clipboard!"); if (!navigator.clipboard) {
setHint(url);
} else {
navigator.clipboard
.writeText(url)
.then(() => {
setHint("Challenge link copied to clipboard!");
})
.catch(() => {
setHint(url);
});
}
}} }}
> >
Challenge a friend to this word Challenge a friend to this word