Sha256: 01485b52baba456fa3e35ae92c4c9c4190c724cf481d0c8b024b3a48a54cf1ea
Contents?: true
Size: 997 Bytes
Versions: 4
Compression:
Stored size: 997 Bytes
Contents
import * as React from "react"; import assetUrl from "../support/asset_url"; interface IconProps { name: string; userAgent: string; iconExtraClassName?: string; } export const Icon: React.SFC<IconProps> = ({ name, userAgent, iconExtraClassName }) => { if (userAgent.match(/PhantomJS/) || userAgent.match(/Node/)) { return <span className={`icon ${iconExtraClassName} ${name}`}>{name}</span>; } return ( <svg className={`icon ${iconExtraClassName} ${name}`}> <use xmlnsXlink="http://www.w3.org/1999/xlink" xlinkHref={`${assetUrl("icons.svg")}#${name}`} /> </svg> ); }; Icon.defaultProps = { iconExtraClassName: "icon--before", }; interface IconWithoutUserAgentProps { name: string; iconExtraClassName?: string; } const IconWithoutUserAgent: React.SFC<IconWithoutUserAgentProps> = ({ name, iconExtraClassName }) => ( <Icon name={name} userAgent={navigator.userAgent} iconExtraClassName={iconExtraClassName} /> ); export default IconWithoutUserAgent;
Version data entries
4 entries across 4 versions & 2 rubygems