Skip to content

Commit

Permalink
fix: update Hacker News icon and rearrange button, styles, and functi…
Browse files Browse the repository at this point in the history
…on in alphabetical order
  • Loading branch information
Abd-Elhadi committed Sep 18, 2024
1 parent d57a361 commit 0fa8358
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h2><code>&lt;a&gt;</code></h2>
<div class="shareon">
<a class="facebook"></a>
<a class="fediverse"></a>
<a class="hackernews"></a>
<a class="linkedin"></a>
<a class="mastodon"></a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
Expand All @@ -45,7 +46,6 @@ <h2><code>&lt;a&gt;</code></h2>
<a class="viber"></a>
<a class="vkontakte"></a>
<a class="whatsapp"></a>
<a class="hackernews"></a>
<a class="copy-url"></a>
<a class="email"></a>
<a class="print"></a>
Expand All @@ -57,6 +57,7 @@ <h2><code>&lt;button&gt;</code></h2>
<div class="shareon">
<button class="facebook"></button>
<button class="fediverse"></button>
<button class="hackernews"></button>
<button class="linkedin"></button>
<button class="mastodon"></button>
<button class="messenger" data-fb-app-id="3619024578167617"></button>
Expand All @@ -71,7 +72,6 @@ <h2><code>&lt;button&gt;</code></h2>
<button class="viber"></button>
<button class="vkontakte"></button>
<button class="whatsapp"></button>
<button class="hackernews"></button>
<button class="copy-url"></button>
<button class="email"></button>
<button class="print"></button>
Expand All @@ -88,6 +88,7 @@ <h2><code>&lt;a&gt;</code> with custom params</h2>
>
<a class="facebook"></a>
<a class="fediverse" data-s2f-instance="share2fedi.vercel.app"></a>
<a class="hackernews"></a>
<a class="linkedin"></a>
<a class="mastodon" data-via="@NickKaramoff@fosstodon.org"></a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
Expand All @@ -102,7 +103,6 @@ <h2><code>&lt;a&gt;</code> with custom params</h2>
<a class="viber"></a>
<a class="vkontakte"></a>
<a class="whatsapp"></a>
<a class="hackernews"></a>
<a class="copy-url"></a>
<a class="email"></a>
<a class="web-share"></a>
Expand All @@ -113,6 +113,7 @@ <h2>Specimen</h2>
<div class="shareon specimen">
<a class="facebook"></a>
<a class="fediverse"></a>
<a class="hackernews"></a>
<a class="linkedin"></a>
<a class="mastodon">Toot</a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
Expand All @@ -129,7 +130,6 @@ <h2>Specimen</h2>
<br />
<a class="vkontakte">Поделиться</a>
<a class="whatsapp"></a>
<a class="hackernews"></a>
<a class="copy-url"></a>
<a class="email"></a>
<a class="web-share">Share</a>
Expand Down
2 changes: 1 addition & 1 deletion src/icons/hackernews.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions src/shareon.css
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@
background-image: url("icons/fediverse.svg");
}

.shareon > .hackernews {
background-color: #fb651e;
}
.shareon > .hackernews:before {
background-image: url("icons/hackernews.svg");
}

.shareon > .linkedin {
background-color: #0a66c2;
}
Expand Down Expand Up @@ -207,10 +214,3 @@
.shareon > .whatsapp:before {
background-image: url("icons/whatsapp.svg");
}

.shareon > .hackernews {
background-color: #ff6600;
}
.shareon > .hackernews:before {
background-image: url("icons/hackernews.svg");
}
2 changes: 1 addition & 1 deletion src/shareon.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const urlBuilderMap = {
facebook: (d) => `https://www.facebook.com/sharer/sharer.php?u=${d.url}${d.hashtags ? `&hashtag=%23${d.hashtags.split('%2C')[0]}` : ''}`,
fediverse: (d) => `https://${d.s2fInstance}/?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}${d.via ? `%0D%0A%0D%0A${d.via}` : ''}`,
email: (d) => `mailto:?subject=${d.title}&body=${d.url}`,
hackernews: (d) => `https://news.ycombinator.com/submitlink?u=${d.url}&t=${d.title}`,
linkedin: (d) => `https://www.linkedin.com/sharing/share-offsite/?url=${d.url}`,
mastodon: (d) => `https://toot.kytta.dev/?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}${d.via ? `%0D%0A%0D%0A${d.via}` : ''}`,
messenger: (d) => `https://www.facebook.com/dialog/send?app_id=${d.fbAppId}&link=${d.url}&redirect_uri=${d.url}`,
Expand All @@ -35,7 +36,6 @@ const urlBuilderMap = {
viber: (d) => `viber://forward?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}`,
vkontakte: (d) => `https://vk.com/share.php?url=${d.url}&title=${d.title}${d.media ? `&image=${d.media}` : ''}`,
whatsapp: (d) => `https://wa.me/?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}`,
hackernews: (d) => `https://news.ycombinator.com/submitlink?u=${d.url}&t=${d.title}`,
};

const openUrl = (buttonUrl) => () => {
Expand Down

0 comments on commit 0fa8358

Please sign in to comment.