UNPKG

@primer/components

Version:
28 lines (26 loc) 674 B
import styled from 'styled-components'; import { get } from './constants'; import sx from './sx'; 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-1waaaky-0" })(["display:inline-block;overflow:hidden;line-height:", ";vertical-align:middle;border-radius:", ";", ""], get('lineHeights.condensedUltra'), props => getBorderRadius(props), sx); Avatar.defaultProps = { size: 20, alt: '', square: false }; export default Avatar;