-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/naming #65
Merged
Merged
Refactor/naming #65
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
79c1ea7
add `ServiceName` enum
F-Shahali 7b05c7f
update naming conventions for functions in `services.data`
F-Shahali 19704e3
update `CHANGELOG.md`
F-Shahali 64f3dbf
update naming style
F-Shahali e2a79ee
Merge branch 'dev' into refactor/naming
AHReccese File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export enum ServiceName { | ||
X = 'X', | ||
Email = 'Email', | ||
Gmail = 'Gmail', | ||
Reddit = 'Reddit', | ||
Trello = 'Trello', | ||
Blogger = 'Blogger', | ||
Yahoo = 'Yahoo Mail', | ||
Telegram = 'Telegram', | ||
Whatsapp = 'WhatsApp', | ||
Facebook = 'Facebook', | ||
Linkedin = 'LinkedIn', | ||
Custom = 'Custom Share', | ||
Pinterest = 'Pinterest', | ||
HackerNews = 'Hacker News', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,100 +11,101 @@ import Facebook from '@assets/icons/services/facebook.svg'; | |
import Linkedin from '@assets/icons/services/linkedin.svg'; | ||
import Pinterest from '@assets/icons/services/pinterest.svg'; | ||
import HackerNews from '@assets/icons/services/hacker-news.svg'; | ||
import { ServiceName } from './constants.data'; | ||
|
||
export const services_url = (url: string, subject?: string): { [key: string]: string } => { | ||
export const serviceUrls = (url: string, subject?: string): { [key: string]: string } => { | ||
return { | ||
Email: `mailto:?subject=${subject}&body=${url}`, | ||
Gmail: `https://mail.google.com/mail/u/0/?ui=2&fs=1&tf=cm&su=${subject}&body=${url}`, | ||
Telegram: `https://telegram.me/share/url?url=${url}&text=${subject}`, | ||
X: `https://x.com/intent/post?url=${url}&text=${subject}`, | ||
WhatsApp: `https://api.whatsapp.com/send?text=${subject}%20${url}`, | ||
'Yahoo Mail': `http://compose.mail.yahoo.com/?subject=${subject}&body=${url}`, | ||
'Hacker News': `https://news.ycombinator.com/submitlink?u=${url}&t=${subject}`, | ||
Facebook: `https://www.facebook.com/sharer/sharer.php?u=${url}&t=${subject}`, | ||
LinkedIn: `https://www.linkedin.com/shareArticle?mini=true&url=${url}&text=${subject}`, | ||
Reddit: `https://www.reddit.com/submit?url=${url}&title=${subject}`, | ||
Pinterest: `https://www.pinterest.com/pin/create/button/?url=${url}&media=&description=${subject}`, | ||
Blogger: `https://www.blogger.com/blog_this.pyra?u=${url}&n=${subject}&t&pli=1`, | ||
Trello: `https://trello.com/add-card?name=${subject}&desc=${url}`, | ||
[ServiceName.Email]: `mailto:?subject=${subject}&body=${url}`, | ||
[ServiceName.Gmail]: `https://mail.google.com/mail/u/0/?ui=2&fs=1&tf=cm&su=${subject}&body=${url}`, | ||
[ServiceName.Telegram]: `https://telegram.me/share/url?url=${url}&text=${subject}`, | ||
[ServiceName.X]: `https://x.com/intent/post?url=${url}&text=${subject}`, | ||
[ServiceName.Whatsapp]: `https://api.whatsapp.com/send?text=${subject}%20${url}`, | ||
[ServiceName.Yahoo]: `http://compose.mail.yahoo.com/?subject=${subject}&body=${url}`, | ||
[ServiceName.HackerNews]: `https://news.ycombinator.com/submitlink?u=${url}&t=${subject}`, | ||
[ServiceName.Facebook]: `https://www.facebook.com/sharer/sharer.php?u=${url}&t=${subject}`, | ||
[ServiceName.Linkedin]: `https://www.linkedin.com/shareArticle?mini=true&url=${url}&text=${subject}`, | ||
[ServiceName.Reddit]: `https://www.reddit.com/submit?url=${url}&title=${subject}`, | ||
[ServiceName.Pinterest]: `https://www.pinterest.com/pin/create/button/?url=${url}&media=&description=${subject}`, | ||
[ServiceName.Blogger]: `https://www.blogger.com/blog_this.pyra?u=${url}&n=${subject}&t&pli=1`, | ||
[ServiceName.Trello]: `https://trello.com/add-card?name=${subject}&desc=${url}`, | ||
}; | ||
}; | ||
|
||
export const Services = [ | ||
export const services = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
title: 'Email', | ||
title: ServiceName.Email, | ||
icon: Email, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/email.svg', | ||
bg: '#888990', | ||
}, | ||
{ | ||
title: 'Gmail', | ||
title: ServiceName.Gmail, | ||
icon: Gmail, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/gmail.svg', | ||
bg: '#EA4335', | ||
}, | ||
{ | ||
title: 'Telegram', | ||
title: ServiceName.Telegram, | ||
icon: Telegram, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/telegram.svg', | ||
bg: '#2CA5E0', | ||
}, | ||
{ | ||
title: 'X', | ||
title: ServiceName.X, | ||
icon: X, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/x.svg', | ||
bg: '#1A1A1A', | ||
}, | ||
{ | ||
title: 'WhatsApp', | ||
title: ServiceName.Whatsapp, | ||
icon: Whatsapp, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/whatsapp.svg', | ||
bg: '#12AF0A', | ||
}, | ||
{ | ||
title: 'Yahoo Mail', | ||
title: ServiceName.Yahoo, | ||
icon: Yahoo, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/yahoo.svg', | ||
bg: '#400090', | ||
}, | ||
{ | ||
title: 'Hacker News', | ||
title: ServiceName.HackerNews, | ||
icon: HackerNews, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/hacker-news.svg', | ||
bg: '#ff6600', | ||
}, | ||
{ | ||
title: 'Facebook', | ||
title: ServiceName.Facebook, | ||
icon: Facebook, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/facebook.svg', | ||
bg: '#0866ff', | ||
}, | ||
{ | ||
title: 'LinkedIn', | ||
title: ServiceName.Linkedin, | ||
icon: Linkedin, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/linkedin.svg', | ||
bg: '#007bb5', | ||
}, | ||
{ | ||
title: 'Reddit', | ||
title: ServiceName.Reddit, | ||
icon: Reddit, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/reddit.svg', | ||
bg: '#ff4500', | ||
}, | ||
{ | ||
title: 'Pinterest', | ||
title: ServiceName.Pinterest, | ||
icon: Pinterest, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/pinterest.svg', | ||
bg: '#e60023', | ||
}, | ||
{ | ||
title: 'Blogger', | ||
title: ServiceName.Blogger, | ||
icon: Blogger, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/blogger.svg', | ||
bg: '#fda352', | ||
}, | ||
{ | ||
title: 'Trello', | ||
title: ServiceName.Trello, | ||
icon: Trello, | ||
iconUrl: 'https://github.com/openscilab/mybutton/raw/main/src/Assets/icons/services/trello.svg', | ||
bg: '#0079bf', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
SERVICE_URL
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this constant is indeed a function (processes input and the result varies depending on the input), wouldn't it be better to use the
lowerCamelCase
style?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go with
getServiceURL
@F-Shahali