@primer/react
Version:
An implementation of GitHub's Primer Design System using React
93 lines (87 loc) • 2.18 kB
JavaScript
var reactCompilerRuntime = require('react-compiler-runtime');
var React = require('react');
var AvatarPair_module = require('./AvatarPair.module.css.js');
var clsx = require('clsx');
var jsxRuntime = require('react/jsx-runtime');
var SkeletonAvatar = require('../SkeletonAvatar/SkeletonAvatar.js');
var Avatar = require('../Avatar/Avatar.js');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var React__default = /*#__PURE__*/_interopDefault(React);
const AvatarPair = t0 => {
const $ = reactCompilerRuntime.c(12);
let children;
let className;
let rest;
if ($[0] !== t0) {
({
children,
className,
...rest
} = t0);
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = rest;
} else {
children = $[1];
className = $[2];
rest = $[3];
}
let t1;
if ($[4] !== children) {
t1 = React__default.default.Children.map(children, _temp);
$[4] = children;
$[5] = t1;
} else {
t1 = $[5];
}
const avatars = t1;
let t2;
if ($[6] !== className) {
t2 = clsx.clsx(className, AvatarPair_module.AvatarPair);
$[6] = className;
$[7] = t2;
} else {
t2 = $[7];
}
let t3;
if ($[8] !== avatars || $[9] !== rest || $[10] !== t2) {
t3 = /*#__PURE__*/jsxRuntime.jsx("div", {
className: t2,
...rest,
children: avatars
});
$[8] = avatars;
$[9] = rest;
$[10] = t2;
$[11] = t3;
} else {
t3 = $[11];
}
return t3;
};
AvatarPair.displayName = 'AvatarPair';
function _temp(child, i) {
if (! /*#__PURE__*/React__default.default.isValidElement(child)) {
return child;
}
if (i === 0) {
return /*#__PURE__*/React__default.default.cloneElement(child, {
size: 40
});
}
if (child.type === SkeletonAvatar.SkeletonAvatar) {
return /*#__PURE__*/jsxRuntime.jsx(SkeletonAvatar.SkeletonAvatar, {
...child.props,
size: 20
});
}
return /*#__PURE__*/jsxRuntime.jsx(Avatar.default, {
className: clsx.clsx(child.props.className, AvatarPair_module.AvatarChild),
...child.props,
size: 20
});
}
_temp.displayName = "_temp";
module.exports = AvatarPair;
;