rickvanlieshout.com/src/utils/get-icon.js

65 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-08-01 04:05:23 +02:00
// @flow strict
2020-05-08 18:08:44 +02:00
import { ICONS } from '../constants';
2018-11-09 18:08:48 +01:00
const getIcon = (name: string) => {
2020-05-08 18:08:44 +02:00
let icon;
2018-11-09 18:08:48 +01:00
switch (name) {
2020-05-08 18:07:57 +02:00
case 'twitter':
2020-05-08 18:08:44 +02:00
icon = ICONS.TWITTER;
break;
2020-05-08 18:07:57 +02:00
case 'github':
2020-05-08 18:08:44 +02:00
icon = ICONS.GITHUB;
break;
2020-05-08 18:07:57 +02:00
case 'vkontakte':
2020-05-08 18:08:44 +02:00
icon = ICONS.VKONTAKTE;
break;
2020-05-08 18:07:57 +02:00
case 'telegram':
2020-05-08 18:08:44 +02:00
icon = ICONS.TELEGRAM;
break;
2020-05-08 18:07:57 +02:00
case 'email':
2020-05-08 18:08:44 +02:00
icon = ICONS.EMAIL;
break;
2020-05-08 18:07:57 +02:00
case 'rss':
2020-05-08 18:08:44 +02:00
icon = ICONS.RSS;
break;
2020-05-08 18:07:57 +02:00
case 'linkedin':
2020-05-08 18:08:44 +02:00
icon = ICONS.LINKEDIN;
break;
2020-05-08 18:07:57 +02:00
case 'instagram':
2020-05-08 18:08:44 +02:00
icon = ICONS.INSTAGRAM;
break;
2020-05-08 18:07:57 +02:00
case 'line':
2020-05-08 18:08:44 +02:00
icon = ICONS.LINE;
break;
2020-05-08 18:07:57 +02:00
case 'facebook':
2020-05-08 18:08:44 +02:00
icon = ICONS.FACEBOOK;
break;
2020-05-08 18:07:57 +02:00
case 'gitlab':
2020-05-08 18:08:44 +02:00
icon = ICONS.GITLAB;
break;
2020-05-08 18:07:57 +02:00
case 'weibo':
2020-05-08 18:08:44 +02:00
icon = ICONS.WEIBO;
break;
2020-05-08 18:07:57 +02:00
case 'codepen':
2020-05-08 18:08:44 +02:00
icon = ICONS.CODEPEN;
break;
2020-05-08 18:07:57 +02:00
case 'youtube':
2020-05-08 18:08:44 +02:00
icon = ICONS.YOUTUBE;
break;
2020-05-08 18:07:57 +02:00
case 'soundcloud':
2020-05-08 18:08:44 +02:00
icon = ICONS.SOUNDCLOUD;
break;
2020-05-08 18:07:57 +02:00
case 'medium':
2020-05-08 18:08:44 +02:00
icon = ICONS.MEDIUM;
break;
2018-11-09 18:08:48 +01:00
default:
2020-05-08 18:08:44 +02:00
icon = {};
break;
2018-11-09 18:08:48 +01:00
}
2020-05-08 18:08:44 +02:00
return icon;
};
2018-11-09 18:08:48 +01:00
2020-05-08 18:08:44 +02:00
export default getIcon;