UNPKG

cluedin-widget

Version:

This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.

29 lines (23 loc) 844 B
import React, { Component } from 'react'; import iso from '../../../iso'; import { providers as providersConfig } from '../../config'; const collectionHelper = iso.collection; export default class ProviderOriginalLink extends Component { render() { const { provider, uris } = this.props; let content; const lowerProviderName = provider.name.toLowerCase(); const providerInfo = providersConfig[lowerProviderName]; let url = collectionHelper.find(uris, (uri) => { return uri.indexOf(providerInfo.domain) > -1; }); if (url) { content = (<a href={url} target="_blank">View in {provider.name}</a>); } else if (provider.url) { content = (<a href={provider.url} target="_blank">{provider.name}</a>); } else { content = (<span>{provider.name}</span>); } return content; } };