Sha256: bc8cd3a7a6005ddfef7af8b425c0963577b3c4ba2ed82536a115087a31fe7bf7

Contents?: true

Size: 1.5 KB

Versions: 37

Compression:

Stored size: 1.5 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { globalProps } from '../utilities/globalProps.js'

type IconProps = {
  aria?: Object,
  border?: boolean,
  className?: string,
  fixedWidth?: boolean,
  flip?: "horizontal" | "vertical" | "both" | "none",
  icon: string,
  id?: string,
  inverse?: boolean,
  listItem?: boolean,
  pull?: "left" | "right" | "none",
  pulse?: boolean,
  rotation?: 90 | 180 | 270,
  size?: | "lg"
    | "xs"
    | "sm"
    | "1x"
    | "2x"
    | "3x"
    | "4x"
    | "5x"
    | "6x"
    | "7x"
    | "8x"
    | "9x"
    | "10x",
  spin?: boolean,
}

const flipMap = {
  horizontal: 'fa-flip-horizontal',
  vertical: 'fa-flip-vertical',
  both: 'fa-flip-horizontal fa-flip-vertical',
}

const Icon = (props: IconProps) => {
  const {
    border = false,
    className,
    fixedWidth = true,
    flip = false,
    icon,
    id,
    inverse = false,
    listItem = false,
    pull,
    pulse = false,
    rotation,
    size,
    spin = false,
  } = props
  const classes = classnames(
    className,
    flipMap[flip],
    'pb_icon_kit',
    'far',
    {
      'fa-border': border,
      'fa-fw': fixedWidth,
      'fa-inverse': inverse,
      'fa-li': listItem,
      'fa-pulse': pulse,
      'fa-spin': spin,
      [`fa-${icon}`]: icon,
      [`fa-${size}`]: size,
      [`fa-pull-${pull}`]: pull,
      [`fa-rotate-${rotation}`]: rotation,
    },
    globalProps(props)
  )

  return (
    <i
        className={classes}
        id={id}
    />
  )
}

export default Icon

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
playbook_ui-6.4.2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.1.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha9 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha8 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha7 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.4.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha6 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha5 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.4.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.3.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha4 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha3 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.3.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.2.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.2.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-7.0.0.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx