-
Notifications
You must be signed in to change notification settings - Fork 0
/
socialmediaitem.js
32 lines (31 loc) · 905 Bytes
/
socialmediaitem.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
/**
* @ngdoc directive
* @name portfolioApp.directive:socialMediaItem
* @description
* # socialMediaItem
*/
angular.module('portfolioApp')
.directive('socialMediaItem', function () {
return {
restrict: 'A',
scope: {
link: '@href',
network: '@socialMediaItem'
},
link: function ($scope) {
var key = $scope.network.replace(/ /g, '-').toLowerCase();
$scope.iconClass = 'fa fa-globe';
if (['bitbucket', 'github', 'twitter', 'stack-overflow', 'linkedin', 'hacker-news'].indexOf(key) >= 0){
$scope.iconClass = 'fab fa-' + key;
} else if (key === 'email'){
$scope.iconClass = 'fa fa-at';
}
},
template: '' +
'<a href="{{link}}" class="btn btn-default" alt="{{network}}">' +
' <i class="{{iconClass}}" aria-hidden="true"></i>' +
' <span class="sr-only">{{network}}{{\'\' | translate}}</span>' +
'</a>'
};
});