Sha256: 4fa974420593bf4eb85e6d8a06910925605cf77a43e499270ee62c98103f2447

Contents?: true

Size: 1.88 KB

Versions: 44

Compression:

Stored size: 1.88 KB

Contents

import React from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps, noop } from '../utilities/props'
import { globalProps } from '../utilities/globalProps'

import Button from '../pb_button/_button'
import Icon from '../pb_icon/_icon'

type CircleIconButtonProps = {
  aria?: { [key: string]: string },
  className?: string,
  dark?: boolean,
  data?: { [key: string]: string },
  disabled?: boolean,
  icon: string,
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
  id?: string,
  link?: string,
  loading?: boolean,
  onClick?: React.MouseEventHandler<HTMLElement>,
  newWindow?: boolean,
  type?: 'button' | 'submit' | 'reset' | undefined,
  target?: string
  variant?: 'primary' | 'secondary' | 'link',
}

const CircleIconButton = (props: CircleIconButtonProps): React.ReactElement => {
  const {
    aria = {},
    className,
    dark,
    data = {},
    disabled,
    htmlOptions = {},
    icon,
    id,
    loading = false,
    onClick = noop,
    type,
    target,
    link,
    newWindow,
    variant,
  } = props

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

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

export default CircleIconButton

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5341 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5340 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.1.pre.alpha.PLAY1750pbcontenttagkitbutton5339 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.12.0.pre.rc.3 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.12.0.pre.rc.2 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.12.0.pre.rc.1 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.12.0.pre.rc.0 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5315 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5314 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.10.0.pre.alpha.PLAY1750pbcontenttagkitbutton5308 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.1 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.0.pre.rc.17 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.0 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.0.pre.rc.16 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.10.0.pre.alpha.play16825301 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.0.pre.rc.15 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.0.pre.rc.14 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.0.pre.rc.13 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.11.0.pre.rc.12 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx
playbook_ui-14.10.0.pre.alpha.PLAY1774timelinelabelstepspacing5274 app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx