@catho/quantum
Version:
Catho react components
68 lines (67 loc) • 2.62 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _propTypes = _interopRequireDefault(require("prop-types"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _SocialType = _interopRequireDefault(require("./sub-components/SocialType"));
var _theme = require("../shared/theme");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var List = _styledComponents["default"].ul.withConfig({
displayName: "Socials__List",
componentId: "sc-191ggvn-0"
})(["padding:0;display:inline-flex;"]);
var ListItem = _styledComponents["default"].li.withConfig({
displayName: "Socials__ListItem",
componentId: "sc-191ggvn-1"
})(["display:inline-flex;list-style:none;", " &:last-child{margin-right:0;}"], function (_ref) {
var medium = _ref.theme.spacing.medium;
return "margin-right: ".concat(medium, "px;");
});
var SocialWrapper = _styledComponents["default"].section.withConfig({
displayName: "Socials__SocialWrapper",
componentId: "sc-191ggvn-2"
})(["display:inline-flex;"]);
ListItem.displayName = 'ListItem';
var Socials = function Socials(_ref2) {
var items = _ref2.items,
_ref2$size = _ref2.size,
size = _ref2$size === void 0 ? '48' : _ref2$size,
_ref2$theme = _ref2.theme,
theme = _ref2$theme === void 0 ? {
spacing: _theme.spacing
} : _ref2$theme,
_ref2$withBox = _ref2.withBox,
withBox = _ref2$withBox === void 0 ? true : _ref2$withBox;
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SocialWrapper, {
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(List, {
children: items.map(function (item) {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ListItem, {
theme: theme,
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SocialType["default"], {
url: item.url,
type: item.name,
size: size,
title: item.title,
withBox: withBox
}, "social-".concat(item.name))
}, "social-item-".concat(item.name));
})
})
});
};
Socials.propTypes = {
size: _propTypes["default"].string,
theme: _propTypes["default"].shape({
spacing: _propTypes["default"].object
}),
items: _propTypes["default"].arrayOf(_propTypes["default"].shape({
name: _propTypes["default"].oneOf(['facebook', 'twitter', 'youtube']),
url: _propTypes["default"].string,
title: _propTypes["default"].string
}).isRequired).isRequired,
withBox: _propTypes["default"].bool
};
var _default = exports["default"] = Socials;