Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
import React from 'react'
import Vector from 'atoms/Vector'
import { isString } from 'exotic'
import { fromPropsToIdentifier } from 'atoms/Icons/deps'
import { renderWrapper as defaultRenderWrapper } from '../renderProps'
import { DefaultProps } from 'icons/typings'
import FacebookIcon from './FacebookIcon'
import TwitterIcon from './TwitterIcon'
import GoogleIcon from './GoogleIcon'
import InstagramIcon from './InstagramIcon'
import LinkedinIcon from './LinkedinIcon'
import PinterestIcon from './PinterestIcon'
import SocialLinkIcon from './SocialLinkIcon'
import YoutubeIcon from './YoutubeIcon'

// extending interface from Label component
interface Props extends DefaultProps {
  type?: string
}

const wording = {
  description:
    'an exclamation mark inside of a triangle or circle (denoting danger & special attention be payed to this region)',
  title: 'Caution Icon',
  vectorClassName: 'caution',
}

// returning breed based on the breedType
function fromBreedToComponent(type: string) {
  switch (isString(type) && type.toLowerCase()) {
    case 'twitter':
    case 'tw':
      return TwitterIcon
    case 'google':
    case 'g+':
      return GoogleIcon
    case 'linkedin':
    case 'in':
      return LinkedinIcon
    case 'instagram':
    case 'ins':
      return InstagramIcon
    case 'pinterest':
    case 'pin':
      return PinterestIcon
    case 'youtube':
    case 'yt':
      return YoutubeIcon
    case 'facebook':
    case 'fb':
      return FacebookIcon
    case 'social-link':
    case 'link':
      return SocialLinkIcon
    default:
      return 'no-social-icon'
  }
}

class SocialIcon extends React.PureComponent<Props> {
  static defaultProps = {
    renderWrapper: defaultRenderWrapper,
  }

  render() {
    const { type, renderWrapper, ...remainingProps } = this.props
    const Component = fromBreedToComponent(type)
    const componentView = <Component {...remainingProps} />
    return renderWrapper(componentView)
  }
}

export { SocialIcon }
export default SocialIcon