Skip to content

Instantly share code, notes, and snippets.

@BrianLitwin
Created April 14, 2019 02:35
Show Gist options
  • Save BrianLitwin/50f665da5ecaae57636fe8a641adbc84 to your computer and use it in GitHub Desktop.
Save BrianLitwin/50f665da5ecaae57636fe8a641adbc84 to your computer and use it in GitHub Desktop.
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