mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-26 20:22:32 +02:00
Upgrade to Gatsby v2
This commit is contained in:
28
src/utils/get-contact-href.js
Normal file
28
src/utils/get-contact-href.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const getContactHref = (name, contact) => {
|
||||
let href;
|
||||
|
||||
switch (name) {
|
||||
case 'twitter':
|
||||
href = `https://www.twitter.com/${contact}`;
|
||||
break;
|
||||
case 'github':
|
||||
href = `https://github.com/${contact}`;
|
||||
break;
|
||||
case 'vkontakte':
|
||||
href = `https://vk.com/${contact}`;
|
||||
break;
|
||||
case 'telegram':
|
||||
href = `telegram:${contact}`;
|
||||
break;
|
||||
case 'email':
|
||||
href = `mailto:${contact}`;
|
||||
break;
|
||||
default:
|
||||
href = contact;
|
||||
break;
|
||||
}
|
||||
|
||||
return href;
|
||||
};
|
||||
|
||||
export default getContactHref;
|
33
src/utils/get-icon.js
Normal file
33
src/utils/get-icon.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { ICONS } from '../constants';
|
||||
|
||||
const getIcon = (name) => {
|
||||
let icon;
|
||||
|
||||
switch (name) {
|
||||
case 'twitter':
|
||||
icon = ICONS.TWITTER;
|
||||
break;
|
||||
case 'github':
|
||||
icon = ICONS.GITHUB;
|
||||
break;
|
||||
case 'vkontakte':
|
||||
icon = ICONS.VKONTAKTE;
|
||||
break;
|
||||
case 'telegram':
|
||||
icon = ICONS.TELEGRAM;
|
||||
break;
|
||||
case 'email':
|
||||
icon = ICONS.EMAIL;
|
||||
break;
|
||||
case 'rss':
|
||||
icon = ICONS.RSS;
|
||||
break;
|
||||
default:
|
||||
icon = {};
|
||||
break;
|
||||
}
|
||||
|
||||
return icon;
|
||||
};
|
||||
|
||||
export default getIcon;
|
2
src/utils/index.js
Normal file
2
src/utils/index.js
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as getIcon } from './get-icon';
|
||||
export { default as getContactHref } from './get-contact-href';
|
Reference in New Issue
Block a user