All files / applications/go-by-transit/src/component/buttons ReloadButton.tsx

100% Statements 3/3
100% Branches 4/4
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                            10x 10x   10x                            
import { Button } from "@wintermuted/ui-react";
import cx from "classnames";
import React from "react";
import FontAwesome from "react-fontawesome";
 
interface Props {
  onClick: (e) => void;
  disabled: boolean;
  className?: string;
  children?: any;
}
 
export default class ReloadButton extends React.PureComponent<Props> {
  public render() {
    const { disabled, className, children } = this.props;
    const classes = cx("reload-button", className);
 
    return (
      <Button
        disabled={disabled}
        title="Reload arrivals for stop"
        className={classes}
        onClick={this.props.onClick}
      >
        {disabled && <FontAwesome name="refresh" spin={true} size="2x" />}
        {!disabled && <FontAwesome name="refresh" size="2x" />}
        {children}
      </Button>
    );
  }
}