Sha256: 1ce05f3fa0367d19190a444a3c234ca77c9d75526d6069081aa8a15383fc6f5e

Contents?: true

Size: 1.51 KB

Versions: 7

Compression:

Stored size: 1.51 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { Button, Icon } from '../'

import type { Callback } from '../types'

import {
  noop,
} from '../utilities/props'

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

type CircleIconButtonProps = {
  aria?: object,
  className?: String,
  dark?: Boolean,
  data?: object,
  disabled?: Boolean,
  icon: String,
  id?: String,
  link?: String,
  onClick?: Callback,
  newWindow?: Boolean,
  type?: 'button' | 'submit' | 'reset',
  variant?: 'primary' | 'secondary' | 'link',
}

const CircleIconButton = (props: CircleIconButtonProps) => {
  const {
    aria = {},
    className,
    dark,
    data = {},
    disabled,
    icon,
    id,
    onClick = noop,
    type,
    link,
    newWindow,
    variant,
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const classes = classnames(buildCss('pb_circle_icon_button_kit'), className, globalProps(props))

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={classes}
        id={id}
    >
      <Button
          dark={dark}
          disabled={disabled}
          link={link}
          newWindow={newWindow}
          onClick={onClick}
          text={null}
          type={type}
          variant={variant}
      >
        <Icon
            fixedWidth
            icon={icon}
        />
      </Button>
    </div>
  )
}

export default CircleIconButton

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
playbook_ui-6.1.0.pre.alpha5 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx
playbook_ui-6.1.0.pre.alpha4 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx
playbook_ui-6.1.0.pre.alpha3 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx
playbook_ui-6.1.0.pre.alpha2 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx
playbook_ui-6.1.0.pre.alpha1 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx
playbook_ui-6.1.0 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx
playbook_ui-6.0.1.pre.alpha6 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx