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.

68 lines (53 loc) 1.67 kB
import React, { Component } from "react"; import { Link } from "react-router"; import Radium from "radium"; var LinkRadium = Radium(Link); const InsightLinkRouterLinkStyle = { linkWrapper: { margin: '-15px', ':hover': { backgroundColor: '#393939' } }, link: { textDecoration: 'none', fontSize: '14px', display: 'flex', color: '#06979E' }, linkDark: { padding: '15px' } }; class InsightLinkRouterLink extends Component { getEntityLink() { const { entity } = this.props; let id = entity.EntityId; let entityType = entity.EntityType; let orgUrl = '/organization/' + id; let personUrl = '/person/' + id; let entityUrl = '/entity/' + id; if( entityType === '/Organization' ) { return orgUrl; } if( (entityType === '/Person') || ( entityType === '/Infrastructure/User' ) ) { return personUrl; } return entityUrl; } render() { const { dark } = this.props; let linkWrapperStyle = []; let linkStyle = [ InsightLinkRouterLinkStyle.link ]; if( dark ) { linkWrapperStyle.push( InsightLinkRouterLinkStyle.linkWrapper ); linkStyle.push( InsightLinkRouterLinkStyle.linkDark ); } let entityLink = this.getEntityLink(); return (<div style={linkWrapperStyle}> <LinkRadium style={linkStyle} to={entityLink}> {this.props.children} </LinkRadium></div>); } } export default Radium( InsightLinkRouterLink );