import React, { Component } from 'react';
import cls from 'classnames';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { Balloon as NextBalloon } from '@alifd/next';
import { BalloonProps as NextBalloonProps } from '@alifd/next/types/balloon';

interface BalloonProps extends NextBalloonProps {}

class Balloon extends Component<BalloonProps> {
  static Tooltip = NextBalloon.Tooltip;

  render() {
    return (
      <NextBalloon
        {...this.props}
        className={cls(
          this.props.className, {
            'next-balloon-with-title': this.props.title,
            'next-add-closable': this.props.closable,
          })}
        closable = {this.props.closable ? this.props.closable : false}
      />
    );
  }
}

hoistNonReactStatics(Balloon, NextBalloon);
export default Balloon;
