// @flow import React, { type Node } from 'react' import styled from 'react-emotion' import { isEmpty } from 'ramda' import Circle from '../../elements/Circle' import { shouldForwardProp } from '../../utils' const PicAvatar = styled('img', { shouldForwardProp })( { display: 'inline-block', borderRadius: 999999, }, ({ size }) => ({ width: `${size || 48}px`, height: `${size || 48}px`, }), ) type Props = { boxShadow?: string, children?: Node, fullName?: string, initials?: string, secondary?: boolean, size: number, url?: ?string, } const Avatar = ({ boxShadow, children, fullName, initials, secondary, size, url, ...styles }: Props) => ( isEmpty(url) ? ( {isEmpty(initials) ? children : initials} ) : ) Avatar.displayName = 'Avatar' Avatar.defaultProps = { boxShadow: undefined, children: undefined, secondary: false, url: '', fullName: '', initials: '', } export default Avatar