Repository URL to install this package:
|
Version:
0.0.15 ▾
|
import { oneRouter } from '@skava/router';
import { ObservableContainer } from '@skava/packages/libraries/observable-container';
import { socialIconList } from './fixture';
const FacebookAppId = 174209059840584;
class FavoritesContainer extends ObservableContainer {
constructor() {
super(...arguments);
this.getSocialShareList = (props) => {
const { listId, name } = props;
if (listId && name) {
const socialShareList = socialIconList.map((socialIcon) => {
const item = socialIcon;
item.url = this.getSocialShareUrl({ socialIcon, listId, name });
return item;
});
return socialShareList;
}
else {
return socialIconList;
}
};
this.getSocialShareUrl = (props) => {
const { listId, name, socialIcon } = props;
const favoriteShareUrl = oneRouter.get('href') + '/' + listId;
let url = '';
switch (socialIcon.label) {
case 'Facebook':
url =
'https://www.facebook.com/dialog/share?app_id=' +
FacebookAppId +
'&display=popup&caption=' +
name +
'&href=' +
favoriteShareUrl +
'&redirect_uri=https%3A%2F%2Fwww.facebook.com%2F';
return url;
case 'Pinterest':
url =
'https://pinterest.com/pin/create/button/?url=' +
favoriteShareUrl +
'&description=' +
name;
return url;
case 'Twitter':
url = 'https://twitter.com/share?url=' + favoriteShareUrl + '&text=' + name;
return url;
default:
return '';
}
};
}
}
const favoritesContainer = new FavoritesContainer();
export { favoritesContainer, favoritesContainer as container };
//# sourceMappingURL=container.js.map