Repository URL to install this package:
|
Version:
0.9.6 ▾
|
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const styled_1 = require("./styled");
const SocialIcon_1 = __importDefault(require("atoms/Icons/SocialIcon"));
function toWrapperProps(item, index) {
const { label, url, color, bgcolor, breed } = item;
const attributes = {
target: '_blank',
className: 'social-' + index,
title: label,
href: url,
};
return attributes;
}
/**
* using to render social icon
* it uses SocialIcon from atoms with atom link wrapper
*/
function defaultRenderIconWrapper(item, index) {
// console.debug('[SocialIconList] defaultRenderIconWrapper')
// console.dir(item)
const { label, url, color, bgcolor, breed, children } = item;
const attributes = toWrapperProps(item, index);
// @todo need to change the fillColor & bgColor out of the IconLink into a styled.withComponent(Icon)
return (react_1.default.createElement(styled_1.IconListPanel, null,
react_1.default.createElement(styled_1.IconLink, Object.assign({}, attributes, { fillColor: color, bgColor: bgcolor }), children)));
}
exports.defaultRenderIconWrapper = defaultRenderIconWrapper;
function renderSocialIconOnly(item) {
return react_1.default.createElement(SocialIcon_1.default, { type: item.label, breed: item.breed });
}
exports.renderSocialIconOnly = renderSocialIconOnly;
function defaultRenderIcon(item, index, props) {
// console.debug('[SocialIconList] defaultRenderIcon')
// console.dir({ item, props })
const { renderIconWrapper } = props;
const children = renderSocialIconOnly(item);
return renderIconWrapper(Object.assign({}, item, { children }), index);
}
exports.defaultRenderIcon = defaultRenderIcon;
/**
* rendering all social icons list based on the fixtures shared
*/
function defaultRenderIconList(props) {
const { iconsList, renderIcon } = props;
const icon = (item, index) => renderIcon(item, index, props);
const socialIconsView = iconsList.map(icon);
return socialIconsView;
}
exports.defaultRenderIconList = defaultRenderIconList;
/**
* combining all childrens in one wrapper as a children node
*/
function defaultRenderWrapper(props) {
const { children, className } = props;
return react_1.default.createElement(styled_1.IconsListWrapper, { className: className }, children);
}
exports.defaultRenderWrapper = defaultRenderWrapper;
//# sourceMappingURL=renderProps.js.map