Sha256: 36c7e8e271666c8432118dcd373da79b1360ea10f02df6b1952fe8d5a834022a

Contents?: true

Size: 1.5 KB

Versions: 123

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(
    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),
    className
  )

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

export default Icon

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
playbook_ui-9.4.0.alpha.sisense app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.4.0.alpha.user.kit.bug app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.4.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.3.1.pre.alpha2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.4.0.pre.alpha2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.4.0.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.3.1.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.3.0.alpha.inline3 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.3.0.alpha.inline2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.3.0.alpha.inline1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.3.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.2.2.pre.alpha.margin app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.2.2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.2.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.2.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.1.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-9.0.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-8.3.0.alpha.select.pre.margin app/pb_kits/playbook/pb_icon/_icon.jsx