Merge pull request #91 from nunocoracao/85-improve-like-buttons-within-articles

added new icons
This commit is contained in:
Nuno Coração 2022-10-10 15:10:21 +01:00 committed by GitHub
commit 7962843b0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 4 deletions

View file

@ -1,2 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">
<path fill="currentColor" d="M349.9 236.3h-66.1v-59.4h66.1v59.4zm0-204.3h-66.1v60.7h66.1V32zm78.2 144.8H362v59.4h66.1v-59.4zm-156.3-72.1h-66.1v60.1h66.1v-60.1zm78.1 0h-66.1v60.1h66.1v-60.1zm276.8 100c-14.4-9.7-47.6-13.2-73.1-8.4-3.3-24-16.7-44.9-41.1-63.7l-14-9.3-9.3 14c-18.4 27.8-23.4 73.6-3.7 103.8-8.7 4.7-25.8 11.1-48.4 10.7H2.4c-8.7 50.8 5.8 116.8 44 162.1 37.1 43.9 92.7 66.2 165.4 66.2 157.4 0 273.9-72.5 328.4-204.2 21.4.4 67.6.1 91.3-45.2 1.5-2.5 6.6-13.2 8.5-17.1l-13.3-8.9zm-511.1-27.9h-66v59.4h66.1v-59.4zm78.1 0h-66.1v59.4h66.1v-59.4zm78.1 0h-66.1v59.4h66.1v-59.4zm-78.1-72.1h-66.1v60.1h66.1v-60.1z"/></svg> <path fill="currentColor" d="M349.9 236.3h-66.1v-59.4h66.1v59.4zm0-204.3h-66.1v60.7h66.1V32zm78.2 144.8H362v59.4h66.1v-59.4zm-156.3-72.1h-66.1v60.1h66.1v-60.1zm78.1 0h-66.1v60.1h66.1v-60.1zm276.8 100c-14.4-9.7-47.6-13.2-73.1-8.4-3.3-24-16.7-44.9-41.1-63.7l-14-9.3-9.3 14c-18.4 27.8-23.4 73.6-3.7 103.8-8.7 4.7-25.8 11.1-48.4 10.7H2.4c-8.7 50.8 5.8 116.8 44 162.1 37.1 43.9 92.7 66.2 165.4 66.2 157.4 0 273.9-72.5 328.4-204.2 21.4.4 67.6.1 91.3-45.2 1.5-2.5 6.6-13.2 8.5-17.1l-13.3-8.9zm-511.1-27.9h-66v59.4h66.1v-59.4zm78.1 0h-66.1v59.4h66.1v-59.4zm78.1 0h-66.1v59.4h66.1v-59.4zm-78.1-72.1h-66.1v60.1h66.1v-60.1z"/></svg>

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 684 B

View file

@ -0,0 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor" d="M244 84L255.1 96L267.1 84.02C300.6 51.37 347 36.51 392.6 44.1C461.5 55.58 512 115.2 512 185.1V190.9C512 232.4 494.8 272.1 464.4 300.4L283.7 469.1C276.2 476.1 266.3 480 256 480C245.7 480 235.8 476.1 228.3 469.1L47.59 300.4C17.23 272.1 0 232.4 0 190.9V185.1C0 115.2 50.52 55.58 119.4 44.1C164.1 36.51 211.4 51.37 244 84C243.1 84 244 84.01 244 84L244 84zM255.1 163.9L210.1 117.1C188.4 96.28 157.6 86.4 127.3 91.44C81.55 99.07 48 138.7 48 185.1V190.9C48 219.1 59.71 246.1 80.34 265.3L256 429.3L431.7 265.3C452.3 246.1 464 219.1 464 190.9V185.1C464 138.7 430.4 99.07 384.7 91.44C354.4 86.4 323.6 96.28 301.9 117.1L255.1 163.9z"/></svg>

After

Width:  |  Height:  |  Size: 722 B

2
assets/icons/heart.svg Normal file
View file

@ -0,0 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor" d="M47.6 300.4L228.3 469.1c7.5 7 17.4 10.9 27.7 10.9s20.2-3.9 27.7-10.9L464.4 300.4c30.4-28.3 47.6-68 47.6-109.5v-5.8c0-69.9-50.5-129.5-119.4-141C347 36.5 300.6 51.4 268 84L256 96 244 84c-32.6-32.6-79-47.5-124.6-39.9C50.5 55.6 0 115.2 0 185.1v5.8c0 41.5 17.2 81.2 47.6 109.5z"/></svg>

After

Width:  |  Height:  |  Size: 373 B

1
assets/icons/poo.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M268.9 .9c-5.5-.7-11 1.4-14.5 5.7s-4.6 10.1-2.8 15.4c2.8 8.2 4.3 16.9 4.3 26.1c0 44.1-35.7 79.9-79.8 80H160c-35.3 0-64 28.7-64 64c0 19.1 8.4 36.3 21.7 48H104c-39.8 0-72 32.2-72 72c0 23.2 11 43.8 28 57c-34.1 5.7-60 35.3-60 71c0 39.8 32.2 72 72 72H440c39.8 0 72-32.2 72-72c0-35.7-25.9-65.3-60-71c17-13.2 28-33.8 28-57c0-39.8-32.2-72-72-72H394.3c13.3-11.7 21.7-28.9 21.7-48c0-35.3-28.7-64-64-64h-5.5c3.5-10 5.5-20.8 5.5-32c0-48.6-36.2-88.8-83.1-95.1zM192 320c-17.7 0-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32zm160-32c0 17.7-14.3 32-32 32s-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32zm0 108.3c0 2.4-.7 4.8-2.2 6.7c-8.2 10.5-39.5 45-93.8 45s-85.6-34.6-93.8-45c-1.5-1.9-2.2-4.3-2.2-6.7c0-6.8 5.5-12.3 12.3-12.3H339.7c6.8 0 12.3 5.5 12.3 12.3z"/></svg>

After

Width:  |  Height:  |  Size: 849 B

View file

@ -27,6 +27,7 @@ The full list of built-in icons and their corresponding names can referenced bel
| comment | {{< icon comment >}} | | comment | {{< icon comment >}} |
| dev | {{< icon dev >}} | | dev | {{< icon dev >}} |
| discourse | {{< icon discourse >}} | | discourse | {{< icon discourse >}} |
| docker | {{< icon docker >}} |
| dribbble | {{< icon dribbble >}} | | dribbble | {{< icon dribbble >}} |
| edit | {{< icon edit >}} | | edit | {{< icon edit >}} |
| email | {{< icon email >}} | | email | {{< icon email >}} |
@ -39,6 +40,8 @@ The full list of built-in icons and their corresponding names can referenced bel
| google | {{< icon google >}} | | google | {{< icon google >}} |
| hackernews | {{< icon hackernews >}} | | hackernews | {{< icon hackernews >}} |
| hashnode | {{< icon hashnode >}} | | hashnode | {{< icon hashnode >}} |
| heart-empty | {{< icon heart-empty >}} |
| heart | {{< icon heart >}} |
| instagram | {{< icon instagram >}} | | instagram | {{< icon instagram >}} |
| keybase | {{< icon keybase >}} | | keybase | {{< icon keybase >}} |
| kickstarter | {{< icon kickstarter >}} | | kickstarter | {{< icon kickstarter >}} |
@ -57,6 +60,7 @@ The full list of built-in icons and their corresponding names can referenced bel
| pencil | {{< icon pencil >}} | | pencil | {{< icon pencil >}} |
| pgpkey | {{< icon pgpkey >}} | | pgpkey | {{< icon pgpkey >}} |
| pinterest | {{< icon pinterest >}} | | pinterest | {{< icon pinterest >}} |
| poo | {{< icon poo >}} |
| reddit | {{< icon reddit >}} | | reddit | {{< icon reddit >}} |
| researchgate | {{< icon researchgate >}} | | researchgate | {{< icon researchgate >}} |
| search | {{< icon search >}} | | search | {{< icon search >}} |

View file

@ -63,7 +63,7 @@
if (liked) { if (liked) {
liked_article = true liked_article = true
document.querySelectorAll("button[id='likes_button']")[0].innerText = "Remove Like" document.querySelectorAll("button[id='likes_button']")[0].textContent = "Remove Like"
} }
} }
@ -98,7 +98,7 @@
function remove_like_article(id_likes) { function remove_like_article(id_likes) {
console.log("remove") console.log("remove")
liked_article = false liked_article = false
localStorage.setItem(id_likes, false); localStorage.removeItem(id_likes);
document.querySelectorAll("button[id='likes_button']")[0].innerText = "Like" document.querySelectorAll("button[id='likes_button']")[0].innerText = "Like"
auth.signInAnonymously() auth.signInAnonymously()
.then(() => { .then(() => {

View file

@ -1,6 +1,15 @@
<span> <span>
<button id="likes_button" class="border rounded px-3" onclick="process_article()"> <!--button id="likes_button" class="border rounded px-3" onclick="process_article()">
Like Like
</button-->
<button id="likes_button"
style="height: 24px; padding-top: 0;"
class="!rounded-md bg-primary-600 px-4 py-2 !text-neutral !no-underline hover:!bg-primary-500 dark:bg-primary-800 dark:hover:!bg-primary-700"
onclick="process_article()">
{{ partial "icon.html" "like" }}
</button> </button>
</span> </span>
{{- /* Trim EOF */ -}} {{- /* Trim EOF */ -}}