diff --git a/CHANGELOG.md b/CHANGELOG.md index 214692e..1e2eb76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- [#99](https://github.com/kytta/shareon/pull/99) + Email button + ## [2.3.0] - 2023-08-01 ### Added diff --git a/README.md b/README.md index 895767e..968c07e 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Shareon.init(); Create a container with class `shareon` and populate it with elements, class names of which match the names of the social networks (or `copy-url`, for the -'Copy URL' button: +'Copy URL' button): ```html
@@ -110,6 +110,7 @@ names of which match the names of the social networks (or `copy-url`, for the +
``` diff --git a/index.html b/index.html index bde6cca..67907ed 100644 --- a/index.html +++ b/index.html @@ -45,6 +45,7 @@ + @@ -67,6 +68,7 @@ + @@ -94,6 +96,7 @@ + @@ -118,6 +121,7 @@ Поделиться + Share diff --git a/src/icons/email.svg b/src/icons/email.svg new file mode 100644 index 0000000..c694920 --- /dev/null +++ b/src/icons/email.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/shareon.css b/src/shareon.css index 8339582..c5024d5 100644 --- a/src/shareon.css +++ b/src/shareon.css @@ -81,6 +81,10 @@ background-image: url("icons/copy-url-done.svg"); } +.shareon > .email:before { + background-image: url("icons/email.svg"); +} + .shareon > .facebook { background-color: #1877f2; } diff --git a/src/shareon.js b/src/shareon.js index d5ce29f..c8cfc50 100644 --- a/src/shareon.js +++ b/src/shareon.js @@ -18,6 +18,7 @@ import "./shareon.css"; */ const urlBuilderMap = { facebook: (d) => `https://www.facebook.com/sharer/sharer.php?u=${d.url}${d.hashtags? `&hashtag=%23${d.hashtags.split('%2C')[0]}` : ''}`, + email: (d) => `mailto:?subject=${d.title}&body=${d.url}`, 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}`,