-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1309 from alliance-genome/SCRUM-3986
SCRUM-3986 update StrainBackground identifier
- Loading branch information
Showing
1 changed file
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import ExternalLink from '../ExternalLink'; | ||
import { getIdentifier } from './utils'; | ||
|
||
|
||
function StrainBackground({strainBackground}) { | ||
if(strainBackground?.curie && strainBackground?.name) { | ||
const strainName = <span dangerouslySetInnerHTML={{__html: strainBackground.name}}/>; | ||
const strain = strainBackground.curie.slice('SGD:'.length); | ||
return <ExternalLink href={`https://www.yeastgenome.org/strain/${strain}`}>{strainName}</ExternalLink>; | ||
} | ||
return <></>; | ||
const indentifier = getIdentifier(strainBackground); | ||
|
||
if(!indentifier || !strainBackground?.name) return null; | ||
|
||
const strainName = <span dangerouslySetInnerHTML={{__html: strainBackground.name}}/>; | ||
const strain = indentifier.slice('SGD:'.length); | ||
|
||
return <ExternalLink href={`https://www.yeastgenome.org/strain/${strain}`}>{strainName}</ExternalLink>; | ||
} | ||
|
||
export default StrainBackground; |