Sha256: 2f04e086d9f44f4c1934b58202b9a30c92a8600a3afdd74979f43b0212232736
Contents?: true
Size: 1.86 KB
Versions: 367
Compression:
Stored size: 1.86 KB
Contents
/* @flow */ import React from 'react' import classnames from 'classnames' import { buildAriaProps, buildCss, buildDataProps, } from '../utilities/props' import { globalProps } from '../utilities/globalProps' import Avatar from '../pb_avatar/_avatar' import Icon from '../pb_icon/_icon' type AvatarActionButtonProps = { action?: "add" | "remove", aria?: {[key: string]: string}, linkAriaLabel?: string, className?: string, dark?: boolean, data?: Object, id?: string, imageAlt?: string, imageUrl?: string, linkUrl?: string, name?: string, onClick?: React.MouseEventHandler<HTMLSpanElement>, placement?: string, size?: "md" | "lg" | "sm" | "xl" | "xs" | "xxs", } const AvatarActionButton = (props: AvatarActionButtonProps) => { const { action = 'add', aria = {}, linkAriaLabel, className, dark = false, data = {}, id, imageAlt = '', 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 aria-label={linkAriaLabel} href={linkUrl} onClick={onClick} > <Avatar imageAlt={imageAlt} 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
367 entries across 367 versions & 1 rubygems