Sha256: 20c0990bb8439d350e53804452b9ef286bbfbb0608b878b8ba5b91cb43e1523c

Contents?: true

Size: 995 Bytes

Versions: 47

Compression:

Stored size: 995 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

47 entries across 47 versions & 2 rubygems

Version Path
decidim-comments-0.7.4 app/frontend/application/icon.component.tsx
decidim-comments-0.7.3 app/frontend/application/icon.component.tsx
decidim-comments-0.7.2 app/frontend/application/icon.component.tsx
decidim-comments-0.7.1 app/frontend/application/icon.component.tsx
decidim-comments-0.7.0 app/frontend/application/icon.component.tsx
decidim-comments-0.6.8 app/frontend/application/icon.component.tsx
decidim-0.6.8 decidim-comments/app/frontend/application/icon.component.tsx
decidim-comments-0.6.7 app/frontend/application/icon.component.tsx
decidim-0.6.7 decidim-comments/app/frontend/application/icon.component.tsx
decidim-comments-0.6.6 app/frontend/application/icon.component.tsx
decidim-0.6.6 decidim-comments/app/frontend/application/icon.component.tsx
decidim-comments-0.6.5 app/frontend/application/icon.component.tsx
decidim-0.6.5 decidim-comments/app/frontend/application/icon.component.tsx
decidim-comments-0.6.4 app/frontend/application/icon.component.tsx
decidim-0.6.4 decidim-comments/app/frontend/application/icon.component.tsx
decidim-comments-0.6.3 app/frontend/application/icon.component.tsx
decidim-0.6.3 decidim-comments/app/frontend/application/icon.component.tsx
decidim-comments-0.6.2 app/frontend/application/icon.component.tsx
decidim-0.6.2 decidim-comments/app/frontend/application/icon.component.tsx
decidim-comments-0.6.1 app/frontend/application/icon.component.tsx