@primer/components
Version:
Primer react components
41 lines (33 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _constants = require("./constants");
var _sx = _interopRequireDefault(require("./sx"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getBorderRadius({
size,
square
}) {
if (square) {
return size && size <= 24 ? '4px' : '6px';
} else {
return '50%';
}
}
const Avatar = _styledComponents.default.img.attrs(props => ({
height: props.size,
width: props.size
})).withConfig({
displayName: "Avatar",
componentId: "sc-1waaaky-0"
})(["display:inline-block;overflow:hidden;line-height:", ";vertical-align:middle;border-radius:", ";", ";", ""], (0, _constants.get)('lineHeights.condensedUltra'), props => getBorderRadius(props), _constants.COMMON, _sx.default);
Avatar.defaultProps = {
size: 20,
alt: '',
square: false
};
var _default = Avatar;
exports.default = _default;