Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

1.1 KB
Raw Blame
import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { UncontrolledTooltip } from 'reactstrap';

/*
 * @class LoopButton
 * @extends React.Component
 */
function LoopButton({ looping, onLoop, isMobile }) {
  const labelText = looping ? 'Disable animation loop' : 'Enable animation loop';
  const buttonId = 'loop-button';
  return (
    <button
      id={buttonId}
      aria-label={labelText}
      type="button"
      className={
        looping
          ? 'wv-loop-icon-case wv-icon-case no-drag active'
          : 'wv-loop-icon-case wv-icon-case no-drag'
      }
      onClick={onLoop}
    >
      {isMobile
        ? null
        : (
          <UncontrolledTooltip
            id="center-align-tooltip"
            placement="top"
            target={buttonId}
          >
            {labelText}
          </UncontrolledTooltip>
        )}
      <FontAwesomeIcon icon="retweet" className="wv-animation-widget-icon" widthAuto />
    </button>
  );
}

LoopButton.propTypes = {
  looping: PropTypes.bool,
  onLoop: PropTypes.func,
  isMobile: PropTypes.bool,
};

export default LoopButton;