Fixed bugs with Location code refactor

This commit is contained in:
danielyxie
2019-04-03 17:08:11 -07:00
parent 4b95ba9ed1
commit bf9b837e31
24 changed files with 2897 additions and 2571 deletions
+16 -5
View File
@@ -6,28 +6,39 @@ import * as React from "react";
interface IStdButtonProps {
disabled?: boolean;
id?: string;
onClick?: (e: React.MouseEvent<HTMLElement>) => any;
style?: object;
text: string;
tooltip?: string;
}
type IInnerHTMLMarkup = {
__html: string;
}
export class StdButton extends React.Component<IStdButtonProps, any> {
render() {
const hasTooltip = this.props.tooltip !== "";
const hasTooltip = this.props.tooltip != null && this.props.tooltip !== "";
let className = this.props.disabled ? "std-button-disabled" : "std-button";
if (hasTooltip) {
className += " tooltip";
}
// Tooltip will be set using inner HTML
let tooltipMarkup: IInnerHTMLMarkup | null;
if (hasTooltip) {
tooltipMarkup = {
__html: this.props.tooltip!
}
}
return (
<button className={className} onClick={this.props.onClick} style={this.props.style}>
<button className={className} id={this.props.id} onClick={this.props.onClick} style={this.props.style}>
{this.props.text}
{
hasTooltip &&
<span className={"tooltiptext"}>
{this.props.tooltip}
</span>
<span className={"tooltiptext"} dangerouslySetInnerHTML={tooltipMarkup!}></span>
}
</button>
)