@primer/react
Version:
An implementation of GitHub's Primer Design System using React
87 lines (84 loc) • 1.82 kB
JavaScript
import { c } from 'react-compiler-runtime';
import React from 'react';
import classes from './AvatarPair.module.css.js';
import { clsx } from 'clsx';
import { jsx } from 'react/jsx-runtime';
import { SkeletonAvatar } from '../SkeletonAvatar/SkeletonAvatar.js';
import Avatar from '../Avatar/Avatar.js';
const AvatarPair = t0 => {
const $ = 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.Children.map(children, _temp);
$[4] = children;
$[5] = t1;
} else {
t1 = $[5];
}
const avatars = t1;
let t2;
if ($[6] !== className) {
t2 = clsx(className, classes.AvatarPair);
$[6] = className;
$[7] = t2;
} else {
t2 = $[7];
}
let t3;
if ($[8] !== avatars || $[9] !== rest || $[10] !== t2) {
t3 = /*#__PURE__*/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.isValidElement(child)) {
return child;
}
if (i === 0) {
return /*#__PURE__*/React.cloneElement(child, {
size: 40
});
}
if (child.type === SkeletonAvatar) {
return /*#__PURE__*/jsx(SkeletonAvatar, {
...child.props,
size: 20
});
}
return /*#__PURE__*/jsx(Avatar, {
className: clsx(child.props.className, classes.AvatarChild),
...child.props,
size: 20
});
}
_temp.displayName = "_temp";
export { AvatarPair as default };