Created
April 14, 2019 02:35
-
-
Save BrianLitwin/50f665da5ecaae57636fe8a641adbc84 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const typeToCap = (type) => { | |
switch (type) { | |
case "PERSON": | |
return "Person"; | |
case "CONTRIBUTION": | |
return "Contribution"; | |
case "PRIORITY": | |
return "Priority"; | |
} | |
}; | |
export type ToolTipProps = {| | |
+entity: OdysseyEntityType, | |
+color: string, | |
|}; | |
export class ToolTip extends React.Component<ToolTipProps> { | |
render() { | |
const {entity, color} = this.props; | |
const type = entity.type.toLowerCase(); | |
const fullDescription = () => ( | |
<div> | |
<p style={{color: "white"}}>Description: </p> | |
<p style={{color: "grey"}}>{entity.description}</p> | |
</div> | |
); | |
return ( | |
<div> | |
<p style={{color: "white"}}> | |
Type: <span style={{color: "grey"}}>{typeToCap(entity.type)}</span> | |
</p> | |
{entity.description.length > 0 ? fullDescription() : ""} | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment