social_share_rails 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/.standard.yml +3 -0
  4. data/CODE_OF_CONDUCT.md +132 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +195 -0
  7. data/Rakefile +6 -0
  8. data/app/assets/config/social_share_rails.js +3 -0
  9. data/app/assets/images/social_share_rails/email.svg +8 -0
  10. data/app/assets/images/social_share_rails/facebook.svg +8 -0
  11. data/app/assets/images/social_share_rails/google_bookmark.svg +8 -0
  12. data/app/assets/images/social_share_rails/linkedin.svg +8 -0
  13. data/app/assets/images/social_share_rails/pinterest.svg +8 -0
  14. data/app/assets/images/social_share_rails/reddit.svg +6 -0
  15. data/app/assets/images/social_share_rails/rounded-facebook.webp +0 -0
  16. data/app/assets/images/social_share_rails/rounded-linkedin.webp +0 -0
  17. data/app/assets/images/social_share_rails/rounded-reddit.webp +0 -0
  18. data/app/assets/images/social_share_rails/rounded-twitter.webp +0 -0
  19. data/app/assets/images/social_share_rails/telegram.svg +12 -0
  20. data/app/assets/images/social_share_rails/twitter.svg +8 -0
  21. data/app/assets/images/social_share_rails/vkontakte.svg +23 -0
  22. data/app/assets/images/social_share_rails/whatsapp.svg +10 -0
  23. data/app/assets/javascripts/social_share_rails/social_share.js +57 -0
  24. data/app/assets/stylesheets/social_share_rails/social_share.scss +70 -0
  25. data/config/locales/social_share_rails.en.yml +14 -0
  26. data/lib/social_share_rails/engine.rb +31 -0
  27. data/lib/social_share_rails/social_share_helper.rb +32 -0
  28. data/lib/social_share_rails/version.rb +5 -0
  29. data/lib/social_share_rails.rb +10 -0
  30. data/sig/social_share_rails.rbs +4 -0
  31. metadata +152 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0a5e5022502b24e0bbbe02289f1463518b396cef89ef035d1883f0b6e4b3cd7f
4
+ data.tar.gz: eb99ec063ec71398a13d6564ddd31cec74f536a7cc2606dff6aaf45fcd1086f7
5
+ SHA512:
6
+ metadata.gz: 19ff97f4c7f5a5f75e1d4d59b90e4317369debf9d37380890663c807c224e6a289eb2bcad9f3a87d7b96d2436bff08494a2e6f898b7c3dccc4e27b212adab28d
7
+ data.tar.gz: f2fcc111e1b7e6d9130786211199a4a01505dc7a26174b03021c1c8fddc12911a12fbbba95a6d7dffb25f1a39b5ae32f47932e76436a62988e816fa75653d22a
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.0
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Gleydson Tavares
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,195 @@
1
+
2
+ # SocialShareRails
3
+
4
+ SocialShareRails is a Ruby on Rails gem that simplifies the process of adding social sharing buttons to your Rails applications. It supports multiple social platforms, customizable styles, and an easy-to-use API for sharing.
5
+
6
+ ## Features
7
+
8
+ - Supports popular social platforms: Twitter, Facebook, Pinterest, LinkedIn, Reddit, Telegram, WhatsApp, and more.
9
+ - Customizable styles with rounded icons.
10
+ - JavaScript-based popup for sharing links.
11
+ - Google Analytics integration for tracking share events (optional).
12
+ - Easy integration with Rails views and assets pipeline.
13
+
14
+ ---
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's `Gemfile`:
19
+
20
+ ```ruby
21
+ gem 'social_share_rails'
22
+ ```
23
+
24
+ Then, execute:
25
+
26
+ ```bash
27
+ bundle install
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Configuration
33
+
34
+ ### Include the Assets
35
+
36
+ You can require the CSS and JavaScript files directly in your `application.js` and `application.css` (or `.scss`) files:
37
+
38
+ In `app/assets/stylesheets/application.css` (or `application.scss`):
39
+ ```scss
40
+ @import "social_share_rails/social_share";
41
+ ```
42
+
43
+ In `app/assets/javascripts/application.js`:
44
+ ```javascript
45
+ //= require social_share_rails/social_share
46
+ ```
47
+
48
+ If you're using Rails 7 with `importmap`, pin the JavaScript in your `config/importmap.rb`:
49
+
50
+ ```ruby
51
+ pin "social_share_rails", to: "social_share_rails/social_share.js"
52
+ ```
53
+
54
+ And import it in your `app/javascript/application.js`:
55
+
56
+ ```javascript
57
+ import "social_share_rails"
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Usage
63
+
64
+ ### Basic Example
65
+ Add the `social_share` helper to your views:
66
+
67
+ ```erb
68
+ <%= social_share("Share this post", {
69
+ url: "https://example.com",
70
+ allow_sites: %w[twitter facebook linkedin],
71
+ rounded: true
72
+ }) %>
73
+ ```
74
+
75
+ ### Options
76
+
77
+ - **title** (String): The title of the post to share.
78
+ - **url** (String): The URL to share.
79
+ - **image** (String): Optional image URL for platforms that support it.
80
+ - **desc** (String): Optional description of the content.
81
+ - **allow_sites** (Array): List of social platforms to include.
82
+ - **rounded** (Boolean): If `true`, uses rounded icon styles.
83
+
84
+ Example with more options:
85
+
86
+ ```erb
87
+ <%= social_share("Check out this article", {
88
+ url: "https://example.com/article",
89
+ image: "https://example.com/image.jpg",
90
+ desc: "This is an amazing article!",
91
+ allow_sites: %w[twitter facebook pinterest],
92
+ rounded: false
93
+ }) %>
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Supported Platforms
99
+
100
+ - Twitter
101
+ - Facebook
102
+ - Google Bookmarks
103
+ - Pinterest
104
+ - LinkedIn
105
+ - Reddit
106
+ - Telegram
107
+ - WhatsApp (App & Web)
108
+ - VKontakte
109
+ - Email
110
+
111
+ ---
112
+
113
+ ## I18n Support
114
+
115
+ SocialShareRails supports multiple languages using Rails' built-in I18n system. The gem provides default translations for the following keys:
116
+
117
+ ```yaml
118
+ en:
119
+ social_share_rails:
120
+ share_to: Share to %{name}
121
+ twitter: Twitter
122
+ facebook: Facebook
123
+ google_bookmark: Google Bookmark
124
+ pinterest: Pinterest
125
+ email: Email
126
+ linkedin: Linkedin
127
+ vkontakte: Vkontakte
128
+ reddit: Reddit
129
+ telegram: Telegram
130
+ whatsapp_app: WhatsApp
131
+ whatsapp_web: WhatsApp
132
+ ```
133
+
134
+ To customize or add translations, create or modify the appropriate YAML file in your Rails application under `config/locales`. For example, to add translations in Portuguese:
135
+
136
+ ```yaml
137
+ pt-BR:
138
+ social_share_rails:
139
+ share_to: Compartilhar no %{name}
140
+ twitter: Twitter
141
+ facebook: Facebook
142
+ google_bookmark: Favoritos do Google
143
+ pinterest: Pinterest
144
+ email: Email
145
+ linkedin: LinkedIn
146
+ vkontakte: VKontakte
147
+ reddit: Reddit
148
+ telegram: Telegram
149
+ whatsapp_app: WhatsApp (App)
150
+ whatsapp_web: WhatsApp (Web)
151
+ ```
152
+
153
+ After adding your translations, Rails will automatically use them based on the current locale.
154
+
155
+ ---
156
+
157
+ ## Customization
158
+
159
+ ### Custom Styles
160
+ You can override the default styles provided by the gem. Add your own styles in `app/assets/stylesheets/application.scss`:
161
+
162
+ ```scss
163
+ .social-share .share-icon {
164
+ width: 30px;
165
+ height: 30px;
166
+ background-size: cover;
167
+ }
168
+
169
+ .social-share .share-twitter {
170
+ background-image: url('/path/to/your/custom-twitter-icon.svg');
171
+ }
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Development
177
+
178
+ ### Running Tests
179
+ To run the tests locally, use:
180
+
181
+ ```bash
182
+ bundle exec rspec
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Contributing
188
+
189
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/g13ydson/social_share_rails). This project is intended to be a safe, welcoming space for collaboration.
190
+
191
+ ---
192
+
193
+ ## License
194
+
195
+ The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "standard/rake"
5
+
6
+ task default: :standard
@@ -0,0 +1,3 @@
1
+ //= link_directory ../javascripts/social_share_rails .js
2
+ //= link_directory ../stylesheets/social_share_rails .css
3
+ //= link_tree ../images/social_share_rails
@@ -0,0 +1,8 @@
1
+ <svg width="256px" height="256px" viewBox="3781 111 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <desc>Email</desc>
3
+ <defs></defs>
4
+ <g id="email" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(3781.000000, 111.000000)">
5
+ <rect id="bg" fill="#A56EE3" x="0" y="0" width="256" height="256" rx="40"></rect>
6
+ <path d="M218,102.602679 L218,182.357143 C218,186.776786 216.426339,190.560268 213.279018,193.707589 C210.131696,196.854911 206.348214,198.428571 201.928571,198.428571 L54.0714286,198.428571 C49.6517857,198.428571 45.8683036,196.854911 42.7209821,193.707589 C39.5736607,190.560268 38,186.776786 38,182.357143 L38,102.602679 C40.9464286,105.883929 44.328125,108.796875 48.1450893,111.341518 C72.3861607,127.814732 89.0267857,139.366071 98.0669643,145.995536 C101.883929,148.808036 104.981027,151.001116 107.358259,152.574777 C109.735491,154.148438 112.899554,155.75558 116.850446,157.396205 C120.801339,159.03683 124.484375,159.857143 127.899554,159.857143 L128.100446,159.857143 C131.515625,159.857143 135.198661,159.03683 139.149554,157.396205 C143.100446,155.75558 146.264509,154.148438 148.641741,152.574777 C151.018973,151.001116 154.116071,148.808036 157.933036,145.995536 C169.316964,137.758929 185.991071,126.207589 207.955357,111.341518 C211.772321,108.729911 215.120536,105.816964 218,102.602679 L218,102.602679 Z M218,73.0714286 C218,78.3616071 216.359375,83.4174107 213.078125,88.2388393 C209.796875,93.0602679 205.712054,97.1785714 200.823661,100.59375 C175.645089,118.071429 159.975446,128.953125 153.814732,133.238839 C153.145089,133.707589 151.722098,134.728795 149.545759,136.302455 C147.36942,137.876116 145.561384,139.148438 144.121652,140.11942 C142.68192,141.090402 140.940848,142.178571 138.898438,143.383929 C136.856027,144.589286 134.930804,145.493304 133.122768,146.095982 C131.314732,146.698661 129.640625,147 128.100446,147 L127.899554,147 C126.359375,147 124.685268,146.698661 122.877232,146.095982 C121.069196,145.493304 119.143973,144.589286 117.101562,143.383929 C115.059152,142.178571 113.31808,141.090402 111.878348,140.11942 C110.438616,139.148438 108.63058,137.876116 106.454241,136.302455 C104.277902,134.728795 102.854911,133.707589 102.185268,133.238839 C96.0915179,128.953125 87.3191964,122.842634 75.8683036,114.907366 C64.4174107,106.972098 57.5535714,102.200893 55.2767857,100.59375 C51.125,97.78125 47.2075893,93.9140625 43.5245536,88.9921875 C39.8415179,84.0703125 38,79.5 38,75.28125 C38,70.0580357 39.3895089,65.7053571 42.1685268,62.2232143 C44.9475446,58.7410714 48.9151786,57 54.0714286,57 L201.928571,57 C206.28125,57 210.047991,58.5736607 213.228795,61.7209821 C216.409598,64.8683036 218,68.6517857 218,73.0714286 L218,73.0714286 Z" id="Shape" fill="#FFFFFF"></path>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="256px" height="256px" viewBox="312 111 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <desc>Facebook</desc>
3
+ <defs></defs>
4
+ <g id="facebook" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(312.000000, 111.000000)">
5
+ <rect id="bg" fill="#2760D8" x="0" y="0" width="256" height="256" rx="40"></rect>
6
+ <path d="M185.230769,37.5865385 L185.230769,72.4903846 L164.473558,72.4903846 C156.893429,72.4903846 151.78125,74.0769231 149.137019,77.25 C146.492788,80.4230769 145.170673,85.1826923 145.170673,91.5288462 L145.170673,116.516827 L183.908654,116.516827 L178.752404,155.651442 L145.170673,155.651442 L145.170673,256 L104.713942,256 L104.713942,155.651442 L71,155.651442 L71,116.516827 L104.713942,116.516827 L104.713942,87.6947115 C104.713942,71.3004808 109.297276,58.5861378 118.463942,49.5516827 C127.630609,40.5172276 139.838141,36 155.086538,36 C168.043269,36 178.091346,36.5288462 185.230769,37.5865385 L185.230769,37.5865385 Z" id="Shape" fill="#FFFFFF"></path>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="256px" height="256px" viewBox="1585 111 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <desc>Google</desc>
3
+ <defs></defs>
4
+ <g id="google" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(1585.000000, 111.000000)">
5
+ <rect id="bg" fill="#3E82F7" x="0" y="0" width="256" height="256" rx="40"></rect>
6
+ <path d="M129.853821,114.697674 L216.564784,114.697674 C217.521595,120.039867 218,125.142857 218,130.006645 C218,147.30897 214.372093,162.757475 207.116279,176.352159 C199.860465,189.946844 189.51495,200.571429 176.079734,208.225914 C162.644518,215.880399 147.23588,219.707641 129.853821,219.707641 C117.335548,219.707641 105.415282,217.295681 94.0930233,212.471761 C82.7707641,207.647841 73.0033223,201.129568 64.7906977,192.916944 C56.5780731,184.704319 50.0598007,174.936877 45.2358804,163.614618 C40.4119601,152.292359 38,140.372093 38,127.853821 C38,115.335548 40.4119601,103.415282 45.2358804,92.0930233 C50.0598007,80.7707641 56.5780731,71.0033223 64.7906977,62.7906977 C73.0033223,54.5780731 82.7707641,48.0598007 94.0930233,43.2358804 C105.415282,38.4119601 117.335548,36 129.853821,36 C153.774086,36 174.305648,44.013289 191.448505,60.0398671 L166.451827,84.0797342 C156.644518,74.5913621 144.445183,69.8471761 129.853821,69.8471761 C119.568106,69.8471761 110.059801,72.4385382 101.328904,77.6212625 C92.5980066,82.8039867 85.6810631,89.8405316 80.5780731,98.730897 C75.4750831,107.621262 72.923588,117.328904 72.923588,127.853821 C72.923588,138.378738 75.4750831,148.086379 80.5780731,156.976744 C85.6810631,165.86711 92.5980066,172.903654 101.328904,178.086379 C110.059801,183.269103 119.568106,185.860465 129.853821,185.860465 C136.790698,185.860465 143.169435,184.903654 148.990033,182.990033 C154.810631,181.076412 159.594684,178.684385 163.342193,175.813953 C167.089701,172.943522 170.358804,169.674419 173.149502,166.006645 C175.940199,162.33887 177.993355,158.870432 179.30897,155.601329 C180.624585,152.332226 181.521595,149.222591 182,146.272425 L129.853821,146.272425 L129.853821,114.697674 L129.853821,114.697674 Z" id="Shape" fill="#FFFFFF"></path>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="256px" height="256px" viewBox="2841 111 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <desc>LinkedIn</desc>
3
+ <defs></defs>
4
+ <g id="linkedin" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(2841.000000, 111.000000)">
5
+ <rect id="bg" fill="#007CCB" x="0" y="0" width="256" height="256" rx="40"></rect>
6
+ <path d="M78.8984375,96.8984375 L78.8984375,213.03125 L40.2265625,213.03125 L40.2265625,96.8984375 L78.8984375,96.8984375 L78.8984375,96.8984375 Z M81.359375,61.0390625 C81.4375,66.7421875 79.4648438,71.5078125 75.4414062,75.3359375 C71.4179688,79.1640625 66.125,81.078125 59.5625,81.078125 L59.328125,81.078125 C52.921875,81.078125 47.765625,79.1640625 43.859375,75.3359375 C39.953125,71.5078125 38,66.7421875 38,61.0390625 C38,55.2578125 40.0117188,50.4726562 44.0351562,46.6835938 C48.0585938,42.8945312 53.3125,41 59.796875,41 C66.28125,41 71.4765625,42.8945312 75.3828125,46.6835938 C79.2890625,50.4726562 81.28125,55.2578125 81.359375,61.0390625 L81.359375,61.0390625 Z M218,146.46875 L218,213.03125 L179.445312,213.03125 L179.445312,150.921875 C179.445312,142.71875 177.863281,136.292969 174.699219,131.644531 C171.535156,126.996094 166.59375,124.671875 159.875,124.671875 C154.953125,124.671875 150.832031,126.019531 147.511719,128.714844 C144.191406,131.410156 141.710938,134.75 140.070312,138.734375 C139.210938,141.078125 138.78125,144.242188 138.78125,148.226563 L138.78125,213.03125 L100.226562,213.03125 C100.382812,181.859375 100.460938,156.585938 100.460938,137.210938 C100.460938,117.835938 100.421875,106.273438 100.34375,102.523438 L100.226562,96.8984375 L138.78125,96.8984375 L138.78125,113.773438 L138.546875,113.773438 C140.109375,111.273438 141.710938,109.085938 143.351562,107.210938 C144.992188,105.335938 147.199219,103.304688 149.972656,101.117188 C152.746094,98.9296875 156.144531,97.2304688 160.167969,96.0195313 C164.191406,94.8085938 168.664062,94.203125 173.585938,94.203125 C186.945312,94.203125 197.6875,98.6367188 205.8125,107.503906 C213.9375,116.371094 218,129.359375 218,146.46875 L218,146.46875 Z" id="Shape" fill="#FFFFFF"></path>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="256px" height="256px" viewBox="2527 111 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <desc>Pinterest</desc>
3
+ <defs></defs>
4
+ <g id="pinterest" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(2527.000000, 111.000000)">
5
+ <rect id="bg" fill="#D60018" x="0" y="0" width="256" height="256" rx="40"></rect>
6
+ <path d="M48,107.625 C48,98.625 49.5625,90.1458333 52.6875,82.1875 C55.8125,74.2291667 60.125,67.2916667 65.625,61.375 C71.125,55.4583333 77.4583333,50.3333333 84.625,46 C91.7916667,41.6666667 99.5,38.4166667 107.75,36.25 C116,34.0833333 124.416667,33 133,33 C146.166667,33 158.416667,35.7708333 169.75,41.3125 C181.083333,46.8541667 190.291667,54.9166667 197.375,65.5 C204.458333,76.0833333 208,88.0416667 208,101.375 C208,109.375 207.208333,117.208333 205.625,124.875 C204.041667,132.541667 201.541667,139.916667 198.125,147 C194.708333,154.083333 190.541667,160.3125 185.625,165.6875 C180.708333,171.0625 174.666667,175.354167 167.5,178.5625 C160.333333,181.770833 152.458333,183.375 143.875,183.375 C138.208333,183.375 132.583333,182.041667 127,179.375 C121.416667,176.708333 117.416667,173.041667 115,168.375 C114.166667,171.625 113,176.3125 111.5,182.4375 C110,188.5625 109.020833,192.520833 108.5625,194.3125 C108.104167,196.104167 107.25,199.0625 106,203.1875 C104.75,207.3125 103.666667,210.270833 102.75,212.0625 C101.833333,213.854167 100.5,216.458333 98.75,219.875 C97,223.291667 95.0833333,226.520833 93,229.5625 C90.9166667,232.604167 88.3333333,236.208333 85.25,240.375 L83.5,241 L82.375,239.75 C81.125,226.666667 80.5,218.833333 80.5,216.25 C80.5,208.583333 81.3958333,199.979167 83.1875,190.4375 C84.9791667,180.895833 87.75,168.916667 91.5,154.5 C95.25,140.083333 97.4166667,131.625 98,129.125 C95.3333333,123.708333 94,116.666667 94,108 C94,101.083333 96.1666667,94.5833333 100.5,88.5 C104.833333,82.4166667 110.333333,79.375 117,79.375 C122.083333,79.375 126.041667,81.0625 128.875,84.4375 C131.708333,87.8125 133.125,92.0833333 133.125,97.25 C133.125,102.75 131.291667,110.708333 127.625,121.125 C123.958333,131.541667 122.125,139.333333 122.125,144.5 C122.125,149.75 124,154.104167 127.75,157.5625 C131.5,161.020833 136.041667,162.75 141.375,162.75 C145.958333,162.75 150.208333,161.708333 154.125,159.625 C158.041667,157.541667 161.3125,154.708333 163.9375,151.125 C166.5625,147.541667 168.895833,143.583333 170.9375,139.25 C172.979167,134.916667 174.5625,130.3125 175.6875,125.4375 C176.8125,120.5625 177.645833,115.9375 178.1875,111.5625 C178.729167,107.1875 179,103.041667 179,99.125 C179,84.7083333 174.4375,73.4791667 165.3125,65.4375 C156.1875,57.3958333 144.291667,53.375 129.625,53.375 C112.958333,53.375 99.0416667,58.7708333 87.875,69.5625 C76.7083333,80.3541667 71.125,94.0416667 71.125,110.625 C71.125,114.291667 71.6458333,117.833333 72.6875,121.25 C73.7291667,124.666667 74.8541667,127.375 76.0625,129.375 C77.2708333,131.375 78.3958333,133.270833 79.4375,135.0625 C80.4791667,136.854167 81,138.125 81,138.875 C81,141.208333 80.375,144.25 79.125,148 C77.875,151.75 76.3333333,153.625 74.5,153.625 C74.3333333,153.625 73.625,153.5 72.375,153.25 C68.125,152 64.3541667,149.666667 61.0625,146.25 C57.7708333,142.833333 55.2291667,138.895833 53.4375,134.4375 C51.6458333,129.979167 50.2916667,125.479167 49.375,120.9375 C48.4583333,116.395833 48,111.958333 48,107.625 L48,107.625 Z" id="Shape" fill="#FFFFFF"></path>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,6 @@
1
+ <svg width="256px" height="256px" viewBox="-2 111 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <g id="reddit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-2.000000, 111.000000)">
3
+ <rect id="bg" fill="#FF4200" x="0" y="0" width="256" height="256" rx="40"></rect>
4
+ <path d="M213.2 128.6Q213.2 134.4 210.25 139.15T202.3 146.4Q203.5 151 203.5 156 203.5 171.5 192.85 184.7T163.8 205.55 123.8 213.2 83.85 205.55 54.85 184.7 44.2 156Q44.2 151.3 45.3 146.6 40.2 144.1 37.1 139.25T34 128.6Q34 120.4 39.8 114.55T53.9 108.7Q62.4 108.7 68.4 115 90.2 99.8 119.9 98.8L131.5 46.7Q131.8 45.4 133 44.6T135.6 44.1L172.5 52.2Q174.3 48.5 177.9 46.25T185.8 44Q192 44 196.4 48.35T200.8 58.9 196.4 69.5 185.8 73.9 175.25 69.55 170.9 59L137.5 51.6 127.1 98.8Q157.1 99.7 179 114.8 184.8 108.7 193.3 108.7 201.6 108.7 207.4 114.55T213.2 128.6zM75.8 148.5Q75.8 154.7 80.15 159.1T90.7 163.5 101.3 159.1 105.7 148.5 101.3 137.95 90.7 133.6Q84.6 133.6 80.2 138T75.8 148.5zM156.8 184Q157.9 182.9 157.9 181.4T156.8 178.8Q155.8 177.8 154.3 177.8T151.7 178.8Q147.6 183 139.6 185T123.6 187 107.6 185 95.5 178.8Q94.4 177.8 92.9 177.8T90.4 178.8Q89.3 179.8 89.3 181.35T90.4 184Q94.7 188.3 102.25 190.8T114.5 193.75 123.6 194.2 132.7 193.75 144.95 190.8 156.8 184zM156.5 163.5Q162.7 163.5 167.05 159.1T171.4 148.5Q171.4 142.4 167 138T156.5 133.6Q150.3 133.6 145.9 137.95T141.5 148.5 145.9 159.1 156.5 163.5z" id="Shape" fill="#FFFFFF"/>
5
+ </g>
6
+ </svg>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="256px" height="256px" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
+ <defs></defs>
4
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
+ <g id="Telegram" fill-rule="nonzero">
6
+ <g>
7
+ <rect id="bg" fill="#2CA5E0" x="0" y="0" width="256" height="256" rx="40"></rect>
8
+ <path d="M204.880365,65.162903 C208.60471,47.8937213 200.808099,46.2077658 183.075486,51.9998895 C165.342888,57.7920147 119.866369,74.6474875 112.212217,77.3642762 C104.558065,80.0810649 67.2943384,92.6052512 59.5686067,96.3422173 C43.7886805,104.806232 51.4649755,117.723167 69.1055729,124.430145 C121.831303,149.738762 106.859895,136.841866 130.399221,183.67197 C135.243558,195.635178 146.666149,216.012662 157.606248,200.609263 C163.357432,191.848576 171.061557,166.027781 175.467686,153.985604 C181.070621,138.672462 201.5864,80.4365211 204.880365,65.162903 Z" id="sharp" fill="#FFFFFF"></path>
9
+ </g>
10
+ </g>
11
+ </g>
12
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="256px" height="256px" viewBox="-2 111 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <desc>Twitter</desc>
3
+ <defs></defs>
4
+ <g id="twitter" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-2.000000, 111.000000)">
5
+ <rect id="bg" fill="#1DA1F2" x="0" y="0" width="256" height="256" rx="40"></rect>
6
+ <path d="M218,74.6546875 C212.898477,81.8132812 206.730964,87.9126953 199.497462,92.9529297 C199.573604,93.9755859 199.611675,95.5095703 199.611675,97.5548828 C199.611675,107.050977 198.164975,116.528809 195.271574,125.988379 C192.378173,135.447949 187.980964,144.524023 182.079949,153.216602 C176.178934,161.90918 169.154822,169.597363 161.007614,176.281152 C152.860406,182.964941 143.038071,188.297363 131.540609,192.278418 C120.043147,196.259473 107.746193,198.25 94.6497462,198.25 C74.0152284,198.25 55.1319797,192.954102 38,182.362305 C40.6649746,182.654492 43.6345178,182.800586 46.9086294,182.800586 C64.0406091,182.800586 79.3071066,177.760352 92.7081218,167.679883 C84.713198,167.533789 77.5558376,165.178027 71.2360406,160.612598 C64.9162437,156.047168 60.5761421,150.22168 58.215736,143.136133 C60.7284264,143.501367 63.0507614,143.683984 65.1827411,143.683984 C68.4568528,143.683984 71.6928934,143.282227 74.8908629,142.478711 C66.3629442,140.798633 59.3007614,136.72627 53.7043147,130.261621 C48.107868,123.796973 45.3096447,116.291406 45.3096447,107.744922 L45.3096447,107.306641 C50.4873096,110.082422 56.0456853,111.579883 61.9847716,111.799023 C56.9593909,108.584961 52.9619289,104.384766 49.9923858,99.1984375 C47.0228426,94.0121094 45.5380711,88.3875 45.5380711,82.3246094 C45.5380711,75.8964844 47.213198,69.9431641 50.5634518,64.4646484 C59.7766497,75.3486328 70.9885787,84.0594727 84.1992386,90.597168 C97.4098985,97.1348633 111.553299,100.768945 126.629442,101.499414 C126.020305,98.7236328 125.715736,96.0208984 125.715736,93.3912109 C125.715736,83.6029297 129.313452,75.2573242 136.508883,68.3543945 C143.704315,61.4514648 152.403553,58 162.606599,58 C173.266497,58 182.251269,61.7253906 189.560914,69.1761719 C197.860406,67.6421875 205.664975,64.7933594 212.974619,60.6296875 C210.15736,69.0300781 204.751269,75.53125 196.756345,80.1332031 C203.837563,79.4027344 210.918782,77.5765625 218,74.6546875 L218,74.6546875 Z" id="Shape" fill="#FFFFFF"></path>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1"
4
+ id="Layer_1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
5
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 256 256"
6
+ style="enable-background:new 0 0 256 256;" xml:space="preserve">
7
+ <style type="text/css">
8
+ .st0{fill:#4C75A3;}
9
+ .st1{fill:#FFFFFF;}
10
+ </style>
11
+ <g id="g5856">
12
+ <path id="rect2987" class="st0" d="M42.5,0h171C237,0,256,19,256,42.5v171c0,23.5-19,42.5-42.5,42.5h-171C19,256,0,237,0,213.5
13
+ v-171C0,19,19,0,42.5,0z"/>
14
+ <path id="path9-3" class="st1" d="M193.4,134c-7.1-7.6-16.5-12.7-28.2-15.1v-1c8.2-3.4,14.6-8.7,19.2-15.9c4.6-7.2,7-15.5,7-24.8
15
+ c0-8-1.7-15.1-5-21.2c-3.4-6.1-8.4-11-15.2-14.7c-6.3-3.4-13-5.6-20.2-6.7c-7.2-1.1-17.8-1.6-31.7-1.6H52v190h76.1
16
+ c13.2,0,24.1-1.2,32.6-3.6c8.5-2.4,16.4-6.4,23.5-12c6-4.7,10.8-10.6,14.4-17.7c3.6-7.1,5.4-15.4,5.4-24.9
17
+ C204,151.9,200.5,141.6,193.4,134L193.4,134z M99.5,67.8h3.3c8.5,0,14.9,0.1,19.2,0.2c4.3,0.1,8,0.9,11.2,2.2
18
+ c3.3,1.5,5.8,3.8,7.3,7c1.6,3.2,2.4,6.4,2.4,9.4c0,4.2-0.7,7.8-2.2,11s-4.1,5.6-7.9,7.4c-3.5,1.6-6.9,2.5-10.1,2.7
19
+ c-3.3,0.2-9,0.3-17.2,0.3h-6V67.8L99.5,67.8z M151.9,176.2c-2,3.6-5.2,6.4-9.5,8.2c-4.9,2.1-9.8,3.3-14.5,3.4
20
+ c-4.8,0.2-13.4,0.3-25.8,0.3h-2.6v-47.6h8.8c8.5,0,15.3,0.1,20.4,0.2c5.1,0.1,9,0.7,11.9,1.9c4.8,1.7,8.3,4.2,10.7,7.5
21
+ s3.6,7.9,3.6,13.8C154.9,168.5,153.9,172.6,151.9,176.2L151.9,176.2z"/>
22
+ </g>
23
+ </svg>
@@ -0,0 +1,10 @@
1
+ <svg width="256px" height="256px" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <desc>WhatsApp</desc>
3
+ <defs></defs>
4
+ <g id="whatsapp" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
5
+ <rect id="bg" fill="#57BA63" x="0" y="0" width="256" height="256" rx="40"></rect>
6
+ <g id="Shape" transform="translate(58.000000, 58.000000)" fill="#FFFFFF">
7
+ <path d="M71.2724475,136.394222 C59.2215576,136.394222 47.9002222,133.314222 38.0504454,127.908666 L0,140 L12.4039994,103.410223 C6.1475556,93.1326657 2.54333205,81.0802212 2.54333205,68.1971109 C2.54333205,30.5324424 33.3137774,0 71.2740021,0 C109.229559,0 140,30.5324424 140,68.1971109 C140,105.861779 109.231113,136.394222 71.2724475,136.394222 Z M71.0000021,11 C39.0161515,11 13,36.7945829 13,68.5 C13,81.0813905 17.1049385,92.733024 24.0469509,102.213136 L16.8020247,123.566402 L39.0895382,116.488687 C48.2487489,122.496244 59.219188,126 71.0000021,126 C102.979163,126 129,100.206976 129,68.501559 C129,36.7961419 102.979163,11 71.0000021,11 Z M105.75822,83.6071414 C105.338032,82.9152786 104.222686,82.4973758 102.55275,81.6662107 C100.878182,80.8350455 92.6505531,76.809237 91.1196504,76.2566724 C89.5841162,75.7025651 88.4672219,75.4224136 87.3534194,77.0878375 C86.2396127,78.7532614 83.0325986,82.4973758 82.0547376,83.6071414 C81.0784204,84.718458 80.1036513,84.8577603 78.4306276,84.0250442 C76.7591477,83.1938791 71.3677812,81.4371379 64.9753794,75.7706673 C60.0026527,71.3625498 56.6442462,65.9205114 55.6694771,64.2535407 C54.6931599,62.5896594 55.5659729,61.690392 56.4032567,60.8623248 C57.1555791,60.1162895 58.0762804,58.919843 58.9135642,57.9493797 C59.750848,56.9773654 60.0289147,56.2855026 60.5850441,55.174186 C61.1442611,54.0644162 60.8646547,53.0939529 60.4460107,52.25969 C60.0273709,51.4285248 56.6797754,43.2437971 55.2863623,39.912945 C53.8929492,36.5851908 52.5010799,37.1393023 51.5232189,37.1393023 C50.5469018,37.1393023 49.4315554,37 48.3162049,37 C47.2008543,37 45.3872576,37.416356 43.8532631,39.0802331 C42.3208166,40.7456612 38,44.7699228 38,52.9531038 C38,61.1378316 43.9922964,69.0455057 44.8311241,70.1537245 C45.666864,71.2619433 56.4017129,88.6034173 73.4084646,95.2635704 C90.4214,101.922177 90.4214,99.7010943 93.4893807,99.4240365 C96.5527298,99.1469828 103.383854,95.4013259 104.781903,91.5179134 C106.173772,87.631403 106.173772,84.300551 105.75822,83.6071414 Z"></path>
8
+ </g>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,57 @@
1
+ window.SocialShare = {
2
+ openUrl: function(url, width = 640, height = 480) {
3
+ const left = (screen.width / 2) - (width / 2);
4
+ const top = (screen.height * 0.3) - (height / 2);
5
+ const options = `width=${width},height=${height},left=${left},top=${top},menubar=no,status=no,location=no`;
6
+ window.open(url, 'popup', options);
7
+ return false;
8
+ },
9
+
10
+ getEncodedAttributes: function(el, site, parent, keys) {
11
+ const result = {};
12
+ keys.forEach(key => {
13
+ result[key] = encodeURIComponent(el.getAttribute(`data-${site}-${key}`) || parent.getAttribute(`data-${key}`) || '');
14
+ });
15
+ return result;
16
+ },
17
+
18
+ trackEvent: function(site) {
19
+ const ga = window[window['GoogleAnalyticsObject'] || 'ga'];
20
+ if (typeof ga === 'function') {
21
+ ga('send', 'event', 'Social Share Button', 'click', site);
22
+ }
23
+ },
24
+
25
+ share: function(el) {
26
+ if (!el.getAttribute) el = document.querySelector(el);
27
+
28
+ const site = el.getAttribute("data-site");
29
+ const parent = el.parentNode;
30
+ const { title, url, desc } = this.getEncodedAttributes(el, site, parent, ['title', 'url', 'desc']);
31
+ const img = encodeURIComponent(parent.getAttribute("data-img") || '');
32
+ const via = encodeURIComponent(parent.getAttribute("data-via") || '');
33
+
34
+ this.trackEvent(site);
35
+
36
+ const actions = {
37
+ email: () => location.href = `mailto:?subject=${title}&body=${url}`,
38
+ twitter: () => {
39
+ const hashtags = encodeURIComponent(el.getAttribute(`data-${site}-hashtags`) || parent.getAttribute('data-hashtags') || '');
40
+ const viaStr = via ? `&via=${via}` : '';
41
+ this.openUrl(`https://twitter.com/intent/tweet?url=${url}&text=${title}&hashtags=${hashtags}${viaStr}`, 650, 300);
42
+ },
43
+ facebook: () => this.openUrl(`http://www.facebook.com/sharer/sharer.php?u=${url}`, 555, 400),
44
+ google_bookmark: () => this.openUrl(`https://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=${url}&title=${title}`),
45
+ pinterest: () => this.openUrl(`http://www.pinterest.com/pin/create/button/?url=${url}&media=${img}&description=${title}`),
46
+ linkedin: () => this.openUrl(`https://www.linkedin.com/shareArticle?mini=true&url=${url}&title=${title}&summary=${desc}`),
47
+ vkontakte: () => this.openUrl(`http://vk.com/share.php?url=${url}&title=${title}&image=${img}`),
48
+ reddit: () => this.openUrl(`http://www.reddit.com/submit?url=${url}&title=${title}&newwindow=1`, 555, 400),
49
+ telegram: () => this.openUrl(`https://telegram.me/share/url?text=${title}&url=${url}`),
50
+ whatsapp_app: () => window.open(`whatsapp://send?text=${title}%0A${url}`, '_top'),
51
+ whatsapp_web: () => this.openUrl(`https://web.whatsapp.com/send?text=${title}%0A${url}`)
52
+ };
53
+
54
+ if (actions[site]) actions[site]();
55
+ return false;
56
+ }
57
+ };
@@ -0,0 +1,70 @@
1
+ .social-share .share-icon {
2
+ background-position: center center;
3
+ background-repeat: no-repeat;
4
+ background-size: 25px 25px;
5
+ display: inline-block;
6
+ height: 25px;
7
+ width: 25px;
8
+ }
9
+
10
+ .social-share .share-icon:hover {
11
+ transform: scale(1.1);
12
+ opacity: 0.8;
13
+ }
14
+
15
+ .social-share .share-twitter {
16
+ background-image: asset-url('social_share_rails/twitter.svg');
17
+ }
18
+
19
+ .social-share .rounded-twitter {
20
+ background-image: asset-url('social_share_rails/rounded-twitter.webp');
21
+ }
22
+
23
+ .social-share .share-facebook {
24
+ background-image: asset-url('social_share_rails/facebook.svg');
25
+ }
26
+
27
+ .social-share .rounded-facebook {
28
+ background-image: asset-url('social_share_rails/rounded-facebook.webp');
29
+ }
30
+
31
+ .social-share .share-google_bookmark {
32
+ background-image: asset-url('social_share_rails/google_bookmark.svg');
33
+ }
34
+
35
+ .social-share .share-pinterest {
36
+ background-image: asset-url('social_share_rails/pinterest.svg');
37
+ }
38
+
39
+ .social-share .share-email {
40
+ background-image: asset-url('social_share_rails/email.svg');
41
+ }
42
+
43
+ .social-share .share-linkedin {
44
+ background-image: asset-url('social_share_rails/linkedin.svg');
45
+ }
46
+
47
+ .social-share .rounded-linkedin {
48
+ background-image: asset-url('social_share_rails/rounded-linkedin.webp');
49
+ }
50
+
51
+ .social-share .share-vkontakte {
52
+ background-image: asset-url('social_share_rails/vkontakte.svg');
53
+ }
54
+
55
+ .social-share .share-reddit {
56
+ background-image: asset-url('social_share_rails/reddit.svg');
57
+ }
58
+
59
+ .social-share .rounded-reddit {
60
+ background-image: asset-url('social_share_rails/rounded-reddit.webp');
61
+ }
62
+
63
+ .social-share .share-telegram {
64
+ background-image: asset-url('social_share_rails/telegram.svg');
65
+ }
66
+
67
+ .social-share .share-whatsapp_app,
68
+ .social-share .share-whatsapp_web {
69
+ background-image: asset-url('social_share_rails/whatsapp.svg');
70
+ }
@@ -0,0 +1,14 @@
1
+ en:
2
+ social_share_rails:
3
+ share_to: Share to %{name}
4
+ twitter: Twitter
5
+ facebook: Facebook
6
+ google_bookmark: Google Bookmark
7
+ pinterest: Pinterest
8
+ email: Email
9
+ linkedin: Linkedin
10
+ vkontakte: Vkontakte
11
+ reddit: Reddit
12
+ telegram: Telegram
13
+ whatsapp_app: WhatsApp
14
+ whatsapp_web: WhatsApp
@@ -0,0 +1,31 @@
1
+ module SocialShareRails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace SocialShareRails
4
+
5
+ # Add the gem's assets to the Rails asset pipeline
6
+ initializer "social_share_rails.assets.paths" do |app|
7
+ app.config.assets.paths << root.join("app", "assets", "javascripts")
8
+ app.config.assets.paths << root.join("app", "assets", "stylesheets")
9
+ app.config.assets.paths << root.join("app", "assets", "images")
10
+ end
11
+
12
+ # Configure the files for precompilation
13
+ initializer "social_share_rails.assets.precompile" do |app|
14
+ app.config.assets.precompile += %w[
15
+ social_share_rails/social_share.js
16
+ social_share_rails/social_share.scss
17
+ social_share_rails/*.svg
18
+ social_share_rails/*.png
19
+ social_share_rails/*.jpg
20
+ social_share_rails/*.webp
21
+ ]
22
+ end
23
+
24
+ # Include the helper in the context of Rails views
25
+ initializer "social_share_rails.helpers" do
26
+ ActiveSupport.on_load(:action_view) do
27
+ include SocialShareRails::SocialShareHelper
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ module SocialShareRails
2
+ module SocialShareHelper
3
+ def social_share(title = "", opts = {})
4
+ opts[:allow_sites] ||= %w[twitter facebook google_bookmark pinterest email linkedin vkontakte reddit telegram whatsapp_app whatsapp_web]
5
+ is_rounded = opts.delete(:rounded) || false
6
+
7
+ html = []
8
+ html << "<div class='social-share' data-title='#{ERB::Util.html_escape(title)}' data-img='#{opts[:image]}'"
9
+ html << "data-url='#{opts[:url]}' data-desc='#{opts[:desc]}'>"
10
+
11
+ opts[:allow_sites].each do |name|
12
+ special_data = opts.select { |k, _| k.to_s.start_with?("data-" + name) }
13
+
14
+ # Generate CSS class based on rounded option
15
+ css_class = "share-icon share-#{name}"
16
+ css_class += " rounded-#{name}" if is_rounded
17
+
18
+ link_title = I18n.t("social_share.share_to", name: I18n.t("social_share.#{name.downcase}"))
19
+ html << link_to("", "#", {
20
+ rel: ["nofollow", opts[:rel]],
21
+ "data-site": name,
22
+ class: css_class,
23
+ onclick: "return SocialShare.share(this);",
24
+ title: ERB::Util.html_escape(link_title)
25
+ }.merge(special_data))
26
+ end
27
+
28
+ html << "</div>"
29
+ raw html.join("\n")
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SocialShareRails
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "social_share_rails/version"
4
+ require "social_share_rails/engine"
5
+ require "social_share_rails/social_share_helper"
6
+
7
+ module SocialShareRails
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
@@ -0,0 +1,4 @@
1
+ module SocialShareRails
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: social_share_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gleydson Tavares
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-01-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: i18n
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.2'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '8.0'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '4.2'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '8.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.10'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.10'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.0'
89
+ description: SocialShareRails is a gem that simplifies adding social sharing buttons
90
+ to Rails applications. It supports multiple social platforms, customizable styles,
91
+ and provides an easy-to-use API for sharing.
92
+ email:
93
+ - tavares.gleydson@gmail.com
94
+ executables: []
95
+ extensions: []
96
+ extra_rdoc_files: []
97
+ files:
98
+ - ".rspec"
99
+ - ".standard.yml"
100
+ - CODE_OF_CONDUCT.md
101
+ - LICENSE.txt
102
+ - README.md
103
+ - Rakefile
104
+ - app/assets/config/social_share_rails.js
105
+ - app/assets/images/social_share_rails/email.svg
106
+ - app/assets/images/social_share_rails/facebook.svg
107
+ - app/assets/images/social_share_rails/google_bookmark.svg
108
+ - app/assets/images/social_share_rails/linkedin.svg
109
+ - app/assets/images/social_share_rails/pinterest.svg
110
+ - app/assets/images/social_share_rails/reddit.svg
111
+ - app/assets/images/social_share_rails/rounded-facebook.webp
112
+ - app/assets/images/social_share_rails/rounded-linkedin.webp
113
+ - app/assets/images/social_share_rails/rounded-reddit.webp
114
+ - app/assets/images/social_share_rails/rounded-twitter.webp
115
+ - app/assets/images/social_share_rails/telegram.svg
116
+ - app/assets/images/social_share_rails/twitter.svg
117
+ - app/assets/images/social_share_rails/vkontakte.svg
118
+ - app/assets/images/social_share_rails/whatsapp.svg
119
+ - app/assets/javascripts/social_share_rails/social_share.js
120
+ - app/assets/stylesheets/social_share_rails/social_share.scss
121
+ - config/locales/social_share_rails.en.yml
122
+ - lib/social_share_rails.rb
123
+ - lib/social_share_rails/engine.rb
124
+ - lib/social_share_rails/social_share_helper.rb
125
+ - lib/social_share_rails/version.rb
126
+ - sig/social_share_rails.rbs
127
+ homepage: https://github.com/g13ydson/social_share_rails
128
+ licenses:
129
+ - MIT
130
+ metadata:
131
+ allowed_push_host: https://rubygems.org
132
+ homepage_uri: https://github.com/g13ydson/social_share_rails
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: 2.5.9
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubygems_version: 3.5.9
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Add customizable social sharing buttons to your Ruby on Rails app.
152
+ test_files: []