Sha256: c06ec2f97b4fae883b07c45a62874146bc3cc82b019b159113e4d2c8f84361dd

Contents?: true

Size: 1.49 KB

Versions: 44

Compression:

Stored size: 1.49 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { spacing } from '../utilities/spacing.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,
    },
    spacing(props)
  )

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

export default Icon

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.5.1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.5.0 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_icon/_icon.jsx
playbook_ui-5.2.0.pre.alpha9 app/pb_kits/playbook/pb_icon/_icon.jsx