Sha256: 6c0a660bf9a0151b8d99f1ba35589e4040588055cb1cd47279917e54c65fe06f

Contents?: true

Size: 1.29 KB

Versions: 38

Compression:

Stored size: 1.29 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'

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 = ({
  border = false,
  className,
  fixedWidth = true,
  flip = false,
  icon,
  id,
  inverse = false,
  listItem = false,
  pull,
  pulse = false,
  rotation,
  size,
  spin = false,
}: IconProps) => {
  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,
  })

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

export default Icon

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
playbook_ui-4.17.0.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.16.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.15.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.14.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.13.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.13.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.12.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.11.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.10.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.9.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.8.2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.8.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.7.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.7.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-4.6.1 app/pb_kits/playbook/pb_icon/_icon.jsx