render()

in src/components/IconButton.tsx [124:156]


  render() {
    const {
      name,
      size = 'md',
      iconType,
      tooltip,
      tooltipPlacement,
      ariaLabel,
      className,
      variant = 'secondary',
      theme,
      ...restProps
    } = this.props;

    const styles = this.getStyles();
    const tooltipString = typeof tooltip === 'string' ? tooltip : '';

    const button = (
      <button ref={this.props.innerRef} aria-label={ariaLabel || tooltipString} {...restProps} className={cx(styles.button, className)}>
        <Icon name={name} size={size} className={styles.icon} type={iconType} />
      </button>
    );

    if (tooltip) {
      return (
        <Tooltip content={tooltip} placement={tooltipPlacement}>
          {button}
        </Tooltip>
      );
    }

    return button;
  }