UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

33 lines (29 loc) 911 B
import styled from 'styled-components'; import { get } from '../constants.js'; import sx from '../sx.js'; function getBorderRadius({ size, square }) { if (square) { return size && size <= 24 ? '4px' : '6px'; } else { return '50%'; } } const Avatar = styled.img.attrs(props => ({ height: props.size, width: props.size })).withConfig({ displayName: "Avatar", componentId: "sc-2lv0r8-0" })(["display:inline-block;overflow:hidden;line-height:", ";vertical-align:middle;border-radius:", ";box-shadow:0 0 0 1px ", ";", ""], get('lineHeights.condensedUltra'), props => getBorderRadius(props), get('colors.avatar.border'), sx); // TODO: Remove defaultProps to be compatible with the next major version of React // Reference: https://github.com/primer/react/issues/2758 Avatar.defaultProps = { size: 20, alt: '', square: false }; var Avatar$1 = Avatar; export { Avatar$1 as default };