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:02:54 +02:00
import { ICONS } from "../constants";
2018-11-09 18:08:48 +01:00
const getIcon = (name: string) => {
2018-11-09 18:08:48 +01:00
let icon;
switch (name) {
2020-05-08 18:02:54 +02:00
case "twitter":
2018-11-09 18:08:48 +01:00
icon = ICONS.TWITTER;
break;
2020-05-08 18:02:54 +02:00
case "github":
2018-11-09 18:08:48 +01:00
icon = ICONS.GITHUB;
break;
2020-05-08 18:02:54 +02:00
case "vkontakte":
2018-11-09 18:08:48 +01:00
icon = ICONS.VKONTAKTE;
break;
2020-05-08 18:02:54 +02:00
case "telegram":
2018-11-09 18:08:48 +01:00
icon = ICONS.TELEGRAM;
break;
2020-05-08 18:02:54 +02:00
case "email":
2018-11-09 18:08:48 +01:00
icon = ICONS.EMAIL;
break;
2020-05-08 18:02:54 +02:00
case "rss":
2018-11-09 18:08:48 +01:00
icon = ICONS.RSS;
break;
2020-05-08 18:02:54 +02:00
case "linkedin":
icon = ICONS.LINKEDIN;
break;
2020-05-08 18:02:54 +02:00
case "instagram":
icon = ICONS.INSTAGRAM;
break;
2020-05-08 18:02:54 +02:00
case "line":
icon = ICONS.LINE;
break;
2020-05-08 18:02:54 +02:00
case "facebook":
icon = ICONS.FACEBOOK;
break;
2020-05-08 18:02:54 +02:00
case "gitlab":
2019-08-24 09:53:42 +02:00
icon = ICONS.GITLAB;
break;
2020-05-08 18:02:54 +02:00
case "weibo":
2019-08-24 09:53:42 +02:00
icon = ICONS.WEIBO;
break;
2020-05-08 18:02:54 +02:00
case "codepen":
2019-09-08 19:34:13 +02:00
icon = ICONS.CODEPEN;
break;
2020-05-08 18:02:54 +02:00
case "youtube":
2019-12-07 08:48:40 +01:00
icon = ICONS.YOUTUBE;
break;
2020-05-08 18:02:54 +02:00
case "soundcloud":
2020-01-08 08:05:20 +01:00
icon = ICONS.SOUNDCLOUD;
break;
2020-05-08 18:02:54 +02:00
case "medium":
icon = ICONS.MEDIUM;
break;
2018-11-09 18:08:48 +01:00
default:
icon = {};
break;
}
return icon;
};
2019-09-08 19:34:13 +02:00
export default getIcon;