Sha256: af9b6523bd28c135fdb1c1dfe94ea7885246acdc20ab9d0f5d9111508eee548b

Contents?: true

Size: 1.39 KB

Versions: 50

Compression:

Stored size: 1.39 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { Avatar, Icon } from '../'

import {
  buildAriaProps,
  buildCss,
  buildDataProps,
} from '../utilities/props'

type AvatarActionButtonProps = {
  action?: String,
  aria: Object,
  className?: String,
  data?: Object,
  id?: String,
  imageUrl?: String,
  linkUrl?: String,
  name?: String,
  onClick?: String,
  placement?: String,
  size?: String,
}

const AvatarActionButton = ({
  action = 'add',
  aria = {},
  className,
  data = {},
  id,
  imageUrl,
  linkUrl,
  name,
  onClick,
  placement = 'bottom left',
  size = 'md',
}: AvatarActionButtonProps) => {
  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)

  const css = buildCss({
    'pb_avatar_action_button_kit': true,
    [action]: true,
    [placement]: true,
    [size]: true,
  })

  const icons = {
    add: 'plus-circle',
    remove: 'times-circle',
  }

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={classnames(css, className)}
        id={id}
    >
      <a
          href={linkUrl}
          onClick={onClick}
      >
        <Avatar
            imageUrl={imageUrl}
            name={name}
            size={size}
        />
        <div className="icon">
          <Icon
              icon={icons[action]}
          />
        </div>
      </a>
    </div>
  )
}

export default AvatarActionButton

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
playbook_ui-6.1.0.pre.alpha5 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.1.0.pre.alpha4 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.1.0.pre.alpha3 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.1.0.pre.alpha2 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.1.0.pre.alpha1 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.1.0 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.0.1.pre.alpha6 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx