'use strict';
import '../../stylesheets/attachments/image-caret.scss';

import * as React from 'react';
import classNames from 'classnames';
import filesize from '../../utils/filesize';

class ImageCaret extends React.PureComponent {
  public props: {
    size?: number;
    open: boolean;
    onClick?: (event: any) => void;
    block?: boolean;
  };
  render() {
    const { size, open, onClick, block } = this.props;
    return (
      <span
        className={classNames('attachment__image-caret', {
          'attachment__image-caret--block': block
        })}
      >
        ({filesize(size)})
        <span
          className={classNames('attachment__image-caret-icon icon-caret', {
            'attachment__image-caret-icon--closed': !open
          })}
          onClick={onClick}
        />
      </span>
    );
  }
}

export default ImageCaret;
