all the lints

This commit is contained in:
Olivier Gagnon
2021-05-01 03:17:31 -04:00
parent abe0330dc3
commit d745150c45
231 changed files with 1458 additions and 1439 deletions
+26 -9
View File
@@ -5,7 +5,7 @@ import * as React from "react";
interface IStdButtonPurchasedProps {
onClick?: (e: React.MouseEvent<HTMLElement>) => any;
style?: object;
style?: any;
text: string;
tooltip?: string;
}
@@ -15,18 +15,35 @@ type IInnerHTMLMarkup = {
}
export class StdButtonPurchased extends React.Component<IStdButtonPurchasedProps, any> {
render() {
const hasTooltip = this.props.tooltip != null && this.props.tooltip !== "";
constructor(props: IStdButtonPurchasedProps) {
super(props);
this.hasTooltip = this.hasTooltip.bind(this);
this.tooltip = this.tooltip.bind(this);
}
hasTooltip(): boolean {
return this.props.tooltip != null && this.props.tooltip !== "";
}
tooltip(): string {
if(!this.props.tooltip) return "";
return this.props.tooltip;
}
render(): React.ReactNode {
let className = "std-button-bought";
if (hasTooltip) {
if (this.hasTooltip()) {
className += " tooltip";
}
// Tooltip will be set using inner HTML
let tooltipMarkup: IInnerHTMLMarkup | null;
if (hasTooltip) {
let tooltipMarkup: IInnerHTMLMarkup = {
__html: "",
}
if (this.hasTooltip()) {
tooltipMarkup = {
__html: this.props.tooltip!,
__html: this.tooltip(),
}
}
@@ -34,8 +51,8 @@ export class StdButtonPurchased extends React.Component<IStdButtonPurchasedProps
<button className={className} onClick={this.props.onClick} style={this.props.style}>
{this.props.text}
{
hasTooltip &&
<span className={"tooltiptext"} dangerouslySetInnerHTML={tooltipMarkup!}></span>
this.hasTooltip() &&
<span className={"tooltiptext"} dangerouslySetInnerHTML={tooltipMarkup}></span>
}
</button>
)