-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create OncoKB LevelIcon and OncogenicIcon to reuse
- Loading branch information
Showing
8 changed files
with
90 additions
and
42 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
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
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
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
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
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
31 changes: 31 additions & 0 deletions
31
packages/react-mutation-mapper/src/component/oncokb/icon/LevelIcon.tsx
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { DefaultTooltip } from 'cbioportal-frontend-commons'; | ||
import * as React from 'react'; | ||
import { levelIconClassNames } from '../../../util/OncoKbUtils'; | ||
import OncoKbHelper from '../OncoKbHelper'; | ||
|
||
const levelTooltipContent = (level: string) => { | ||
return ( | ||
<div style={{ maxWidth: '200px' }}> | ||
{OncoKbHelper.LEVEL_DESC[level]} | ||
</div> | ||
); | ||
}; | ||
|
||
const LevelIcon: React.FunctionComponent<{ | ||
level: string; | ||
showDescription?: boolean; | ||
}> = props => { | ||
return ( | ||
<DefaultTooltip | ||
overlay={levelTooltipContent(props.level)} | ||
placement="left" | ||
disabled={!props.showDescription} | ||
trigger={['hover', 'focus']} | ||
destroyTooltipOnHide={true} | ||
> | ||
<i className={levelIconClassNames(props.level)} /> | ||
</DefaultTooltip> | ||
); | ||
}; | ||
|
||
export default LevelIcon; |
21 changes: 21 additions & 0 deletions
21
packages/react-mutation-mapper/src/component/oncokb/icon/OncogenicIcon.tsx
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from 'react'; | ||
import { DefaultTooltip } from 'cbioportal-frontend-commons'; | ||
import { oncogenicityIconClassNames } from '../../../util/OncoKbUtils'; | ||
|
||
const OncogenicIcon: React.FunctionComponent<{ | ||
oncogenicity: string; | ||
showDescription?: boolean; | ||
}> = props => { | ||
return ( | ||
<DefaultTooltip | ||
overlay={<span>{props.oncogenicity}</span>} | ||
placement="left" | ||
trigger={['hover', 'focus']} | ||
destroyTooltipOnHide={true} | ||
> | ||
<i className={oncogenicityIconClassNames(props.oncogenicity)} /> | ||
</DefaultTooltip> | ||
); | ||
}; | ||
|
||
export default OncogenicIcon; |