import { FC, MouseEvent } from 'react'

import { DesaturedText, MembershipHandle, OwnerPillWrapper } from './OwnerPill.styles'

import { Avatar } from '../Avatar'

export type OwnerPillProps = {
  handle?: string
  avatar?: {
    assetUrl?: string | null
    loading?: boolean
  }
  title?: string
  onClick?: (e: MouseEvent) => void
}

export const OwnerPill: FC<OwnerPillProps> = ({ handle, avatar, onClick, title }) => {
  return (
    <OwnerPillWrapper onClick={onClick} title={title}>
      <Avatar size="bid" {...avatar} />
      <DesaturedText as="span" variant="t100">
        Owner:
      </DesaturedText>
      <MembershipHandle as="span" variant="t100">
        {handle}
      </MembershipHandle>
    </OwnerPillWrapper>
  )
}
