Mirror of https://github.com/roostorg/osprey github.com/roostorg/osprey
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 26 lines 741 B view raw
1import * as React from 'react'; 2import { GithubOutlined } from '@ant-design/icons'; 3 4import { parsePathString, getSourcesUrl } from '../../utils/SourceUtils'; 5 6interface SourcesLinkProps { 7 path: string; 8} 9export default function SourcesLink({ path }: SourcesLinkProps) { 10 const pathInfo = parsePathString(path); 11 if (pathInfo == null) { 12 // eslint-disable-next-line no-console 13 console.warn(`Tried to render SourcesLink for invalid path: ${path}`); 14 return <>{path}</>; 15 } 16 17 return ( 18 <> 19 {/* eslint-disable-next-line */} 20 <a href={getSourcesUrl(pathInfo)} target="_blank" rel="noopener noreferrer"> 21 <GithubOutlined /> {pathInfo.path}:{pathInfo.lineNumber} 22 </a> 23 {pathInfo.rest} 24 </> 25 ); 26}