Sha256: bbbacf0d1a61c584a27d65a50dd5be95b045776f7799658da5a913d7ea8e9b79

Contents?: true

Size: 1.58 KB

Versions: 122

Compression:

Stored size: 1.58 KB

Contents

/* @flow */

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

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

import { globalProps } from '../utilities/globalProps.js'

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

const AvatarActionButton = (props: AvatarActionButtonProps) => {
  const {
    action = 'add',
    aria = {},
    className,
    dark = false,
    data = {},
    id,
    imageUrl,
    linkUrl,
    name,
    onClick,
    placement = 'bottom left',
    size = 'md',
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)

  const classes = classnames(buildCss(
    'pb_avatar_action_button_kit',
    [action],
    [placement],
    [size]),
  globalProps(props),
  className)

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

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={classes}
        id={id}
    >
      <a
          href={linkUrl}
          onClick={onClick}
      >
        <Avatar
            imageUrl={imageUrl}
            name={name}
            size={size}
        />
        <div className={`icon ${dark ? 'dark' : ''}`}>
          <Icon
              dark={dark}
              icon={icons[action]}
          />
        </div>
      </a>
    </div>
  )
}

export default AvatarActionButton

Version data entries

122 entries across 122 versions & 1 rubygems

Version Path
playbook_ui-8.1.3 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.1.2 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.0.3 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.2.0.pre.alpha2 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.1.1 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.0.2 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.2.0.pre.alpha1 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.1.0 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.0.1 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.0.0 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.0.0.pre.alpha5 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.0.0.pre.alpha4 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-8.0.0.pre.alpha1 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-7.16.0.pre.alpha5 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-7.16.0.pre.alpha4 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-7.16.0.pre.alpha3 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-7.16.0.pre.alpha2 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-7.16.0.pre.alpha1 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx
playbook_ui-7.16.0 app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx